/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd..
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).

https://axmol.dev/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do size., subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

#include "DrawNodeTest.h"
#include "axmol/renderer/Renderer.h"
#include "axmol/renderer/CustomCommand.h"

#if defined(_WIN32)
#    pragma push_macro("TRANSPARENT")
#    undef TRANSPARENT
#endif

USING_NS_AX;
using namespace std;

// clang-format off
Vec2 vertices1[] = {
    {45.750000f, 144.375000f},  {75.500000f, 136.875000f},  {75.500000f, 159.125000f},  {100.250000f, 161.375000f},
    {65.500000f, 181.375000f},  {102.250000f, 179.125000f}, {95.000000f, 215.125000f},  {129.331467f, 189.926208f},
    {131.371460f, 206.366196f}, {139.651474f, 192.446198f}, {161.851471f, 200.606201f}, {151.000000f, 220.375000f},
    {110.500000f, 244.375000f}, {153.750000f, 238.125000f}, {142.500000f, 253.875000f}, {220.750000f, 259.375000f},
    {250.500000f, 244.375000f}, {168.750000f, 241.875000f}, {182.250000f, 154.125000f}, {190.250000f, 227.375000f},
    {196.500000f, 197.375000f}, {208.750000f, 210.625000f}, {220.750000f, 194.375000f}, {208.750000f, 176.375000f},
    {253.250000f, 173.875000f}, {243.750000f, 154.125000f}, {213.750000f, 161.375000f}, {202.250000f, 139.875000f},
    {236.000000f, 131.875000f}, {218.500000f, 120.875000f}, {206.500000f, 125.625000f}, {184.500000f, 110.375000f},
    {157.000000f, 108.625000f}, {147.500000f, 96.625000f},  {153.750000f, 85.125000f},  {147.500000f, 75.375000f},
    {126.500000f, 74.125000f},  {110.500000f, 86.625000f},  {127.750000f, 85.125000f},  {135.250000f, 91.125000f},
    {135.250000f, 97.875000f},  {124.000000f, 93.875000f},  {115.500000f, 100.875000f}, {115.500000f, 111.875000f},
    {135.250000f, 108.625000f}, {151.000000f, 124.125000f}, {90.500000f, 131.875000f},  {113.250000f, 120.875000f},
    {88.000000f, 116.875000f},  {106.000000f, 103.875000f}, {88.000000f, 97.875000f}};

Vec2 vertices2[] = {
    {290.250000f, 98.1250000f}, {235.000000f, 90.8750000f}, {270.500000f, 109.875000f}, {235.000000f, 119.125000f},
    {275.250000f, 145.875000f}, {249.500000f, 145.875000f}, {249.500000f, 178.125000f}, {275.250000f, 187.375015f},
    {294.750488f, 168.333344f}, {311.250000f, 181.125000f}, {257.000000f, 213.625015f}, {338.500000f, 193.125000f},
    {300.000000f, 211.125015f}, {333.750000f, 211.125015f}, {368.250000f, 206.625000f}, {377.000000f, 178.125000f},
    {421.750000f, 170.125000f}, {416.250000f, 115.375000f}, {391.250000f, 157.875000f}, {338.500000f, 131.625000f},
    {362.750000f, 131.625000f}, {362.750000f, 106.875000f}, {306.500000f, 119.125000f}, {324.250000f, 85.1250000f},
    {227.500000f, 61.8750000}};

Vec2 vertices21[] = {
    {290.250000f, 98.1250000f}, {235.000000f, 90.8750000f}, {270.500000f, 109.875000f}, {235.000000f, 119.125000f},
    {275.250000f, 145.875000f}, {249.500000f, 145.875000f}, {249.500000f, 178.125000f}, {275.250000f, 187.375015f},
    {294.750488f, 168.333344f}, {311.250000f, 181.125000f}, {257.000000f, 213.625015f}, {338.500000f, 193.125000f},
    {300.000000f, 211.125015f}, {333.750000f, 211.125015f}, {368.250000f, 206.625000f}, {377.000000f, 178.125000f},
    {421.750000f, 170.125000f}, {416.250000f, 115.375000f}, {391.250000f, 157.875000f}, {338.500000f, 131.625000f},
    {362.750000f, 131.625000f}, {362.750000f, 106.875000f}, {306.500000f, 119.125000f}, {324.250000f, 85.1250000f},
    {227.500000f, 61.8750000}};

Vec2 vertices24[] = {
    {45.750000f, 144.375000f},  {75.500000f, 136.875000f},  {75.500000f, 159.125000f},  {100.250000f, 161.375000f},
    {65.500000f, 181.375000f},  {102.250000f, 179.125000f}, {95.000000f, 215.125000f},  {129.331467f, 189.926208f},
    {131.371460f, 206.366196f}, {139.651474f, 192.446198f}, {161.851471f, 200.606201f}, {151.000000f, 220.375000f},
    {110.500000f, 244.375000f}, {153.750000f, 238.125000f}, {142.500000f, 253.875000f}, {220.750000f, 259.375000f},
    {250.500000f, 244.375000f}, {168.750000f, 241.875000f}, {182.250000f, 154.125000f}, {190.250000f, 227.375000f},
    {196.500000f, 197.375000f}, {208.750000f, 210.625000f}, {220.750000f, 194.375000f}, {208.750000f, 176.375000f},
    {253.250000f, 173.875000f}, {243.750000f, 154.125000f}, {213.750000f, 161.375000f}, {202.250000f, 139.875000f},
    {236.000000f, 131.875000f}, {218.500000f, 120.875000f}, {206.500000f, 125.625000f}, {184.500000f, 110.375000f},
    {157.000000f, 108.625000f}, {147.500000f, 96.625000f},  {153.750000f, 85.125000f},  {147.500000f, 75.375000f},
    {126.500000f, 74.125000f},  {110.500000f, 86.625000f},  {127.750000f, 85.125000f},  {135.250000f, 91.125000f},
    {135.250000f, 97.875000f},  {124.000000f, 93.875000f},  {115.500000f, 100.875000f}, {115.500000f, 111.875000f},
    {135.250000f, 108.625000f}, {151.000000f, 124.125000f}, {90.500000f, 131.875000f},  {113.250000f, 120.875000f},
    {88.000000f, 116.875000f},  {106.000000f, 103.875000f}, {88.000000f, 97.875000f},
};

// Original https :  // www.purebasic.fr/english/viewtopic.php?t=82915
float verticesHead[] = { 107.f,         9.f,
                        0.3333333433f, 0.3411764801f,
                        0.3686274588f, 255.f,
                        81.f,          599.f,
                        116.f,         571.f,
                        180.f,         562.f,
                        255.f,         559.f,
                        213.f,         586.f,
                        199.f,         599.f,
                        0.f,           7.f,
                        0.3333333433f, 0.3411764801f,
                        0.3686274588f, 255.f,
                        765.f,         584.f,
                        782.f,         590.f,
                        794.f,         599.f,
                        772.f,         599.f,
                        0.f,           13.f,
                        0.4156862795f, 0.4313725531f,
                        0.4549019635f, 255.f,
                        278.f,         573.f,
                        287.f,         599.f,
                        199.f,         599.f,
                        217.f,         582.f,
                        256.f,         557.f,
                        313.f,         532.f,
                        352.f,         508.f,
                        366.f,         512.f,
                        368.f,         545.f,
                        285.f,         598.f,
                        0.f,           8.f,
                        0.4156862795f, 0.4313725531f,
                        0.4549019635f, 255.f,
                        760.f,         591.f,
                        754.f,         579.f,
                        766.f,         584.f,
                        773.f,         599.f,
                        751.f,         599.f,
                        0.f,           12.f,
                        0.400000006f,  0.4117647111f,
                        0.4196078479f, 255.f,
                        701.f,         563.f,
                        615.f,         599.f,
                        652.f,         558.f,
                        705.f,         507.f,
                        716.f,         534.f,
                        753.f,         577.f,
                        760.f,         591.f,
                        752.f,         599.f,
                        613.f,         599.f,
                        0.f,           10.f,
                        0.400000006f,  0.4117647111f,
                        0.4196078479f, 255.f,
                        704.f,         506.f,
                        701.f,         493.f,
                        686.f,         488.f,
                        688.f,         503.f,
                        692.f,         514.f,
                        691.f,         528.f,
                        708.f,         518.f,
                        0.f,           8.f,
                        0.4784313738f, 0.3647058904f,
                        0.2156862766f, 255.f,
                        285.f,         599.f,
                        309.f,         579.f,
                        365.f,         546.f,
                        375.f,         578.f,
                        378.f,         599.f,
                        0.f,           16.f,
                        0.4784313738f, 0.3647058904f,
                        0.2156862766f, 255.f,
                        471.f,         599.f,
                        377.f,         599.f,
                        365.f,         546.f,
                        360.f,         511.f,
                        394.f,         515.f,
                        428.f,         507.f,
                        492.f,         471.f,
                        553.f,         417.f,
                        568.f,         397.f,
                        562.f,         422.f,
                        552.f,         462.f,
                        547.f,         487.f,
                        524.f,         529.f,
                        0.f,           19.f,
                        0.5921568871f, 0.4980392158f,
                        0.3647058904f, 255.f,
                        614.f,         599.f,
                        683.f,         531.f,
                        690.f,         512.f,
                        686.f,         493.f,
                        684.f,         429.f,
                        656.f,         245.f,
                        654.f,         242.f,
                        644.f,         273.f,
                        628.f,         288.f,
                        621.f,         288.f,
                        592.f,         308.f,
                        571.f,         378.f,
                        554.f,         454.f,
                        543.f,         494.f,
                        514.f,         542.f,
                        469.f,         599.f,
                        0.f,           12.f,
                        0.5921568871f, 0.4980392158f,
                        0.3647058904f, 255.f,
                        598.f,         259.f,
                        602.f,         233.f,
                        619.f,         236.f,
                        624.f,         250.f,
                        630.f,         257.f,
                        629.f,         269.f,
                        623.f,         291.f,
                        603.f,         312.f,
                        589.f,         311.f,
                        0.f,           15.f,
                        0.4784313738f, 0.3647058904f,
                        0.2156862766f, 255.f,
                        642.f,         211.f,
                        606.f,         197.f,
                        609.f,         236.f,
                        621.f,         236.f,
                        621.f,         246.f,
                        630.f,         256.f,
                        627.f,         279.f,
                        626.f,         286.f,
                        636.f,         282.f,
                        641.f,         274.f,
                        649.f,         250.f,
                        656.f,         221.f,
                        0.f,           24.f,
                        0.4784313738f, 0.3647058904f,
                        0.2156862766f, 255.f,
                        309.f,         333.f,
                        334.f,         269.f,
                        346.f,         207.f,
                        347.f,         169.f,
                        323.f,         42.f,
                        265.f,         39.f,
                        256.f,         156.f,
                        272.f,         212.f,
                        276.f,         302.f,
                        292.f,         372.f,
                        323.f,         469.f,
                        334.f,         500.f,
                        350.f,         509.f,
                        365.f,         511.f,
                        358.f,         472.f,
                        370.f,         451.f,
                        382.f,         438.f,
                        382.f,         433.f,
                        389.f,         392.f,
                        382.f,         309.f,
                        315.f,         291.f,
                        0.f,           35.f,
                        0.5921568871f, 0.4980392158f,
                        0.3647058904f, 255.f,
                        439.f,         399.f,
                        384.f,         393.f,
                        354.f,         396.f,
                        349.f,         395.f,
                        348.f,         405.f,
                        349.f,         421.f,
                        352.f,         428.f,
                        363.f,         434.f,
                        383.f,         435.f,
                        364.f,         458.f,
                        358.f,         473.f,
                        360.f,         499.f,
                        364.f,         512.f,
                        382.f,         516.f,
                        407.f,         514.f,
                        437.f,         506.f,
                        476.f,         482.f,
                        534.f,         437.f,
                        562.f,         408.f,
                        571.f,         382.f,
                        581.f,         346.f,
                        598.f,         0.f,
                        333.f,         0.f,
                        345.f,         190.f,
                        336.f,         249.f,
                        379.f,         333.f,
                        373.f,         347.f,
                        347.f,         353.f,
                        347.f,         371.f,
                        354.f,         377.f,
                        387.f,         384.f,
                        389.f,         396.f,
                        0.f,           7.f,
                        0.5921568871f, 0.4980392158f,
                        0.3647058904f, 255.f,
                        370.f,         309.f,
                        322.f,         296.f,
                        333.f,         268.f,
                        339.f,         238.f,
                        0.f,           10.f,
                        0.5921568871f, 0.4980392158f,
                        0.3647058904f, 255.f,
                        341.f,         289.f,
                        323.f,         293.f,
                        314.f,         317.f,
                        324.f,         328.f,
                        352.f,         326.f,
                        390.f,         332.f,
                        388.f,         288.f,
                        0.f,           12.f,
                        0.4784313738f, 0.3647058904f,
                        0.2156862766f, 255.f,
                        440.f,         145.f,
                        520.f,         146.f,
                        464.f,         167.f,
                        429.f,         220.f,
                        422.f,         222.f,
                        400.f,         206.f,
                        392.f,         188.f,
                        390.f,         173.f,
                        393.f,         160.f,
                        0.f,           15.f,
                        0.7960784435f, 0.7490196228f,
                        0.6705882549f, 255.f,
                        460.f,         194.f,
                        489.f,         189.f,
                        500.f,         199.f,
                        499.f,         211.f,
                        489.f,         217.f,
                        467.f,         223.f,
                        445.f,         224.f,
                        431.f,         217.f,
                        422.f,         209.f,
                        420.f,         200.f,
                        436.f,         181.f,
                        491.f,         189.f,
                        0.f,           12.f,
                        0.7960784435f, 0.7490196228f,
                        0.6705882549f, 255.f,
                        342.f,         199.f,
                        343.f,         211.f,
                        337.f,         218.f,
                        322.f,         222.f,
                        306.f,         221.f,
                        292.f,         212.f,
                        288.f,         197.f,
                        297.f,         186.f,
                        332.f,         189.f,
                        0.f,           13.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        461.f,         182.f,
                        445.f,         184.f,
                        442.f,         196.f,
                        446.f,         210.f,
                        454.f,         218.f,
                        462.f,         219.f,
                        472.f,         217.f,
                        480.f,         207.f,
                        480.f,         196.f,
                        477.f,         185.f,
                        0.f,           11.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        309.f,         186.f,
                        306.f,         192.f,
                        307.f,         204.f,
                        313.f,         213.f,
                        325.f,         216.f,
                        334.f,         210.f,
                        336.f,         197.f,
                        332.f,         189.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        433.f,         186.f,
                        422.f,         199.f,
                        416.f,         199.f,
                        432.f,         179.f,
                        475.f,         183.f,
                        470.f,         185.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        470.f,         183.f,
                        491.f,         187.f,
                        497.f,         194.f,
                        482.f,         188.f,
                        433.f,         184.f,
                        436.f,         181.f,
                        0.f,           10.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        331.f,         190.f,
                        340.f,         199.f,
                        342.f,         197.f,
                        333.f,         188.f,
                        296.f,         184.f,
                        292.f,         186.f,
                        296.f,         186.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        299.f,         187.f,
                        291.f,         198.f,
                        287.f,         198.f,
                        296.f,         185.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        312.f,         176.f,
                        297.f,         178.f,
                        297.f,         181.f,
                        312.f,         177.f,
                        326.f,         181.f,
                        326.f,         179.f,
                        0.f,           11.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        439.f,         172.f,
                        470.f,         174.f,
                        488.f,         180.f,
                        457.f,         176.f,
                        432.f,         176.f,
                        423.f,         180.f,
                        423.f,         178.f,
                        431.f,         173.f,
                        0.f,           10.f,
                        0.7843137383f, 0.7254902124f,
                        0.6078431606f, 255.f,
                        467.f,         186.f,
                        464.f,         189.f,
                        464.f,         194.f,
                        467.f,         199.f,
                        473.f,         198.f,
                        477.f,         193.f,
                        477.f,         188.f,
                        0.f,           10.f,
                        0.7843137383f, 0.7254902124f,
                        0.6078431606f, 255.f,
                        332.f,         191.f,
                        334.f,         194.f,
                        332.f,         198.f,
                        327.f,         198.f,
                        323.f,         196.f,
                        322.f,         192.f,
                        324.f,         188.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        398.f,         195.f,
                        399.f,         204.f,
                        401.f,         208.f,
                        400.f,         198.f,
                        400.f,         194.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        365.f,         434.f,
                        350.f,         427.f,
                        350.f,         427.f,
                        356.f,         433.f,
                        372.f,         437.f,
                        382.f,         434.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        389.f,         393.f,
                        418.f,         401.f,
                        420.f,         403.f,
                        390.f,         396.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        391.f,         397.f,
                        355.f,         397.f,
                        356.f,         396.f,
                        388.f,         393.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        354.f,         397.f,
                        344.f,         393.f,
                        343.f,         390.f,
                        355.f,         396.f,
                        358.f,         396.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        343.f,         392.f,
                        335.f,         393.f,
                        337.f,         391.f,
                        344.f,         389.f,
                        346.f,         392.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        354.f,         379.f,
                        345.f,         372.f,
                        346.f,         370.f,
                        355.f,         377.f,
                        361.f,         373.f,
                        361.f,         377.f,
                        0.f,           11.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        368.f,         336.f,
                        375.f,         337.f,
                        373.f,         340.f,
                        367.f,         337.f,
                        360.f,         340.f,
                        356.f,         346.f,
                        356.f,         342.f,
                        363.f,         336.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        338.f,         337.f,
                        348.f,         351.f,
                        345.f,         351.f,
                        336.f,         339.f,
                        324.f,         327.f,
                        329.f,         328.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        367.f,         325.f,
                        326.f,         327.f,
                        330.f,         330.f,
                        367.f,         327.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        367.f,         326.f,
                        378.f,         331.f,
                        378.f,         328.f,
                        367.f,         325.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        325.f,         327.f,
                        316.f,         317.f,
                        315.f,         319.f,
                        322.f,         328.f,
                        329.f,         332.f,
                        329.f,         329.f,
                        0.f,           10.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        336.f,         256.f,
                        329.f,         284.f,
                        315.f,         312.f,
                        316.f,         312.f,
                        331.f,         267.f,
                        343.f,         213.f,
                        345.f,         214.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        654.f,         243.f,
                        644.f,         272.f,
                        635.f,         283.f,
                        647.f,         261.f,
                        651.f,         238.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        634.f,         282.f,
                        617.f,         290.f,
                        608.f,         301.f,
                        625.f,         287.f,
                        634.f,         286.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        605.f,         310.f,
                        609.f,         302.f,
                        616.f,         294.f,
                        610.f,         295.f,
                        605.f,         307.f,
                        0.f,           10.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        556.f,         578.f,
                        569.f,         550.f,
                        569.f,         544.f,
                        556.f,         576.f,
                        539.f,         599.f,
                        543.f,         599.f,
                        559.f,         576.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        572.f,         548.f,
                        582.f,         507.f,
                        582.f,         496.f,
                        583.f,         496.f,
                        577.f,         537.f,
                        575.f,         552.f,
                        0.f,           10.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        588.f,         497.f,
                        589.f,         474.f,
                        590.f,         468.f,
                        592.f,         467.f,
                        589.f,         499.f,
                        582.f,         527.f,
                        581.f,         521.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        572.f,         376.f,
                        574.f,         376.f,
                        563.f,         411.f,
                        560.f,         411.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        562.f,         406.f,
                        540.f,         432.f,
                        552.f,         422.f,
                        564.f,         409.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        547.f,         425.f,
                        504.f,         463.f,
                        501.f,         463.f,
                        530.f,         443.f,
                        551.f,         424.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        503.f,         462.f,
                        467.f,         488.f,
                        468.f,         489.f,
                        502.f,         465.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        464.f,         489.f,
                        438.f,         504.f,
                        438.f,         506.f,
                        452.f,         501.f,
                        470.f,         490.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        441.f,         503.f,
                        406.f,         513.f,
                        406.f,         515.f,
                        431.f,         509.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        409.f,         513.f,
                        377.f,         513.f,
                        377.f,         516.f,
                        397.f,         516.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        378.f,         514.f,
                        357.f,         510.f,
                        358.f,         513.f,
                        383.f,         517.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        622.f,         282.f,
                        623.f,         289.f,
                        625.f,         288.f,
                        625.f,         281.f,
                        632.f,         269.f,
                        631.f,         264.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        631.f,         267.f,
                        630.f,         257.f,
                        627.f,         247.f,
                        629.f,         266.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        628.f,         251.f,
                        621.f,         239.f,
                        618.f,         239.f,
                        624.f,         250.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        620.f,         241.f,
                        621.f,         231.f,
                        619.f,         229.f,
                        617.f,         241.f,
                        0.f,           10.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        620.f,         231.f,
                        627.f,         226.f,
                        633.f,         218.f,
                        633.f,         215.f,
                        624.f,         226.f,
                        619.f,         229.f,
                        617.f,         237.f,
                        0.f,           8.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        636.f,         274.f,
                        638.f,         260.f,
                        635.f,         252.f,
                        638.f,         267.f,
                        635.f,         275.f,
                        0.f,           11.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        631.f,         251.f,
                        636.f,         257.f,
                        636.f,         259.f,
                        639.f,         257.f,
                        634.f,         250.f,
                        625.f,         249.f,
                        628.f,         253.f,
                        634.f,         253.f,
                        0.f,           11.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        598.f,         339.f,
                        595.f,         334.f,
                        594.f,         328.f,
                        597.f,         328.f,
                        601.f,         337.f,
                        611.f,         339.f,
                        611.f,         341.f,
                        602.f,         342.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        341.f,         198.f,
                        339.f,         187.f,
                        337.f,         187.f,
                        338.f,         197.f,
                        0.f,           9.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        360.f,         512.f,
                        364.f,         546.f,
                        378.f,         599.f,
                        379.f,         599.f,
                        374.f,         572.f,
                        366.f,         547.f,
                        0.f,           7.f,
                        0.4470588267f, 0.3764705956f,
                        0.2666666806f, 255.f,
                        373.f,         583.f,
                        370.f,         599.f,
                        378.f,         599.f,
                        374.f,         577.f,
                        0.f,           19.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        684.f,         453.f,
                        685.f,         478.f,
                        691.f,         473.f,
                        701.f,         460.f,
                        717.f,         414.f,
                        713.f,         382.f,
                        709.f,         374.f,
                        724.f,         312.f,
                        718.f,         299.f,
                        758.f,         118.f,
                        754.f,         83.f,
                        685.f,         48.f,
                        657.f,         247.f,
                        654.f,         281.f,
                        652.f,         289.f,
                        621.f,         328.f,
                        0.f,           10.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        710.f,         443.f,
                        708.f,         402.f,
                        718.f,         405.f,
                        713.f,         443.f,
                        708.f,         460.f,
                        706.f,         460.f,
                        710.f,         438.f,
                        0.f,           11.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        726.f,         378.f,
                        732.f,         402.f,
                        734.f,         419.f,
                        732.f,         420.f,
                        727.f,         392.f,
                        720.f,         381.f,
                        702.f,         371.f,
                        698.f,         344.f,
                        0.f,           14.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        722.f,         308.f,
                        730.f,         328.f,
                        728.f,         354.f,
                        725.f,         365.f,
                        726.f,         348.f,
                        722.f,         359.f,
                        721.f,         361.f,
                        717.f,         339.f,
                        716.f,         357.f,
                        712.f,         359.f,
                        706.f,         282.f,
                        0.f,           10.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        730.f,         292.f,
                        742.f,         281.f,
                        744.f,         275.f,
                        740.f,         278.f,
                        727.f,         287.f,
                        706.f,         292.f,
                        712.f,         301.f,
                        0.f,           11.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        719.f,         284.f,
                        729.f,         274.f,
                        748.f,         237.f,
                        758.f,         208.f,
                        761.f,         182.f,
                        761.f,         142.f,
                        757.f,         110.f,
                        691.f,         262.f,
                        0.f,           10.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        661.f,         433.f,
                        666.f,         445.f,
                        672.f,         456.f,
                        671.f,         453.f,
                        668.f,         433.f,
                        674.f,         424.f,
                        643.f,         349.f,
                        0.f,           10.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        646.f,         432.f,
                        662.f,         407.f,
                        655.f,         356.f,
                        649.f,         412.f,
                        642.f,         431.f,
                        634.f,         443.f,
                        636.f,         444.f,
                        0.f,           14.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        643.f,         413.f,
                        647.f,         404.f,
                        658.f,         389.f,
                        644.f,         314.f,
                        637.f,         328.f,
                        641.f,         402.f,
                        636.f,         422.f,
                        633.f,         427.f,
                        634.f,         428.f,
                        642.f,         417.f,
                        650.f,         401.f,
                        0.f,           8.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        642.f,         385.f,
                        634.f,         377.f,
                        619.f,         329.f,
                        627.f,         322.f,
                        652.f,         323.f,
                        0.f,           16.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        622.f,         373.f,
                        632.f,         383.f,
                        636.f,         385.f,
                        636.f,         382.f,
                        627.f,         374.f,
                        626.f,         367.f,
                        633.f,         364.f,
                        622.f,         326.f,
                        609.f,         340.f,
                        610.f,         348.f,
                        612.f,         359.f,
                        623.f,         376.f,
                        631.f,         382.f,
                        0.f,           21.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        682.f,         97.f,
                        660.f,         248.f,
                        652.f,         242.f,
                        648.f,         234.f,
                        647.f,         227.f,
                        641.f,         223.f,
                        633.f,         216.f,
                        624.f,         206.f,
                        580.f,         194.f,
                        579.f,         179.f,
                        565.f,         159.f,
                        558.f,         133.f,
                        560.f,         123.f,
                        539.f,         93.f,
                        529.f,         68.f,
                        521.f,         16.f,
                        529.f,         0.f,
                        698.f,         0.f,
                        0.f,           13.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        514.f,         48.f,
                        517.f,         92.f,
                        519.f,         106.f,
                        521.f,         106.f,
                        519.f,         81.f,
                        521.f,         59.f,
                        527.f,         39.f,
                        526.f,         7.f,
                        520.f,         16.f,
                        516.f,         32.f,
                        0.f,           8.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        449.f,         59.f,
                        464.f,         36.f,
                        471.f,         16.f,
                        472.f,         1.f,
                        466.f,         13.f,
                        0.f,           8.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        472.f,         0.f,
                        468.f,         21.f,
                        460.f,         31.f,
                        461.f,         6.f,
                        458.f,         0.f,
                        0.f,           20.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        458.f,         0.f,
                        451.f,         26.f,
                        441.f,         52.f,
                        428.f,         76.f,
                        414.f,         92.f,
                        399.f,         103.f,
                        387.f,         116.f,
                        389.f,         113.f,
                        411.f,         75.f,
                        418.f,         45.f,
                        399.f,         76.f,
                        319.f,         131.f,
                        315.f,         112.f,
                        309.f,         98.f,
                        316.f,         83.f,
                        323.f,         51.f,
                        246.f,         0.f,
                        0.f,           12.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        327.f,         149.f,
                        339.f,         172.f,
                        349.f,         189.f,
                        354.f,         194.f,
                        352.f,         188.f,
                        347.f,         167.f,
                        350.f,         123.f,
                        353.f,         114.f,
                        318.f,         128.f,
                        0.f,           8.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        396.f,         77.f,
                        377.f,         96.f,
                        348.f,         121.f,
                        321.f,         131.f,
                        318.f,         116.f,
                        0.f,           15.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        299.f,         59.f,
                        305.f,         88.f,
                        312.f,         105.f,
                        312.f,         84.f,
                        315.f,         62.f,
                        327.f,         44.f,
                        326.f,         23.f,
                        121.f,         0.f,
                        287.f,         56.f,
                        290.f,         78.f,
                        299.f,         101.f,
                        302.f,         107.f,
                        0.f,           14.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        207.f,         0.f,
                        286.f,         50.f,
                        270.f,         86.f,
                        257.f,         144.f,
                        256.f,         244.f,
                        237.f,         220.f,
                        227.f,         206.f,
                        211.f,         191.f,
                        197.f,         161.f,
                        128.f,         56.f,
                        142.f,         0.f,
                        0.f,           12.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        179.f,         168.f,
                        196.f,         198.f,
                        210.f,         221.f,
                        212.f,         219.f,
                        201.f,         200.f,
                        196.f,         174.f,
                        202.f,         148.f,
                        169.f,         96.f,
                        171.f,         141.f,
                        0.f,           16.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        152.f,         157.f,
                        158.f,         178.f,
                        168.f,         198.f,
                        172.f,         206.f,
                        172.f,         202.f,
                        165.f,         178.f,
                        164.f,         154.f,
                        173.f,         121.f,
                        129.f,         48.f,
                        126.f,         78.f,
                        130.f,         108.f,
                        133.f,         121.f,
                        144.f,         146.f,
                        0.f,           10.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        254.f,         155.f,
                        269.f,         202.f,
                        272.f,         221.f,
                        273.f,         258.f,
                        262.f,         243.f,
                        259.f,         248.f,
                        240.f,         222.f,
                        0.f,           14.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        112.f,         33.f,
                        121.f,         12.f,
                        124.f,         0.f,
                        145.f,         0.f,
                        134.f,         34.f,
                        127.f,         38.f,
                        118.f,         58.f,
                        112.f,         92.f,
                        108.f,         100.f,
                        107.f,         86.f,
                        106.f,         63.f,
                        0.f,           24.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        298.f,         146.f,
                        293.f,         134.f,
                        284.f,         132.f,
                        272.f,         136.f,
                        272.f,         138.f,
                        267.f,         140.f,
                        264.f,         149.f,
                        266.f,         158.f,
                        272.f,         157.f,
                        274.f,         159.f,
                        289.f,         154.f,
                        303.f,         157.f,
                        324.f,         171.f,
                        334.f,         176.f,
                        340.f,         181.f,
                        332.f,         171.f,
                        330.f,         162.f,
                        328.f,         153.f,
                        311.f,         146.f,
                        298.f,         136.f,
                        290.f,         133.f,
                        0.f,           22.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        485.f,         139.f,
                        487.f,         130.f,
                        509.f,         129.f,
                        532.f,         137.f,
                        544.f,         152.f,
                        549.f,         168.f,
                        543.f,         164.f,
                        543.f,         168.f,
                        522.f,         159.f,
                        496.f,         155.f,
                        470.f,         156.f,
                        435.f,         164.f,
                        407.f,         173.f,
                        391.f,         171.f,
                        384.f,         168.f,
                        379.f,         156.f,
                        413.f,         151.f,
                        414.f,         148.f,
                        489.f,         129.f,
                        0.f,           16.f,
                        0.1882352978f, 0.1686274558f,
                        0.0862745121f, 255.f,
                        607.f,         191.f,
                        606.f,         241.f,
                        606.f,         275.f,
                        596.f,         314.f,
                        592.f,         314.f,
                        581.f,         350.f,
                        574.f,         364.f,
                        574.f,         364.f,
                        580.f,         328.f,
                        577.f,         326.f,
                        577.f,         312.f,
                        583.f,         247.f,
                        579.f,         164.f,
                        0.f,           13.f,
                        0.1568627506f, 0.1686274558f,
                        0.2352941185f, 255.f,
                        756.f,         68.f,
                        754.f,         97.f,
                        749.f,         104.f,
                        734.f,         107.f,
                        715.f,         100.f,
                        701.f,         102.f,
                        696.f,         97.f,
                        682.f,         26.f,
                        661.f,         0.f,
                        736.f,         0.f,
                        0.f,           11.f,
                        0.1568627506f, 0.1686274558f,
                        0.2352941185f, 255.f,
                        689.f,         76.f,
                        687.f,         88.f,
                        683.f,         99.f,
                        676.f,         99.f,
                        674.f,         78.f,
                        669.f,         39.f,
                        659.f,         0.f,
                        705.f,         0.f,
                        0.f,           9.f,
                        0.1568627506f, 0.1686274558f,
                        0.2352941185f, 255.f,
                        652.f,         0.f,
                        651.f,         16.f,
                        646.f,         29.f,
                        642.f,         31.f,
                        638.f,         24.f,
                        631.f,         0.f,
                        0.f,           9.f,
                        0.1568627506f, 0.1686274558f,
                        0.2352941185f, 255.f,
                        628.f,         0.f,
                        628.f,         20.f,
                        625.f,         27.f,
                        619.f,         29.f,
                        616.f,         19.f,
                        616.f,         0.f,
                        0.f,           12.f,
                        0.1568627506f, 0.1686274558f,
                        0.2352941185f, 255.f,
                        415.f,         0.f,
                        403.f,         31.f,
                        392.f,         54.f,
                        376.f,         68.f,
                        364.f,         74.f,
                        362.f,         70.f,
                        365.f,         61.f,
                        390.f,         25.f,
                        400.f,         0.f,
                        0.f,           12.f,
                        0.1568627506f, 0.1686274558f,
                        0.2352941185f, 255.f,
                        352.f,         42.f,
                        341.f,         66.f,
                        339.f,         82.f,
                        344.f,         81.f,
                        350.f,         70.f,
                        364.f,         44.f,
                        381.f,         21.f,
                        380.f,         16.f,
                        368.f,         19.f,
                        0.f,           11.f,
                        0.1568627506f, 0.1686274558f,
                        0.2352941185f, 255.f,
                        344.f,         0.f,
                        365.f,         0.f,
                        353.f,         21.f,
                        341.f,         49.f,
                        332.f,         62.f,
                        329.f,         58.f,
                        329.f,         51.f,
                        344.f,         0.f,
                        0.f,           10.f,
                        0.1568627506f, 0.1686274558f,
                        0.2352941185f, 255.f,
                        333.f,         2.f,
                        329.f,         17.f,
                        323.f,         23.f,
                        318.f,         18.f,
                        319.f,         6.f,
                        320.f,         0.f,
                        331.f,         0.f,
                        0.f,           11.f,
                        0.1764705926f, 0.1960784346f,
                        0.2666666806f, 255.f,
                        760.f,         0.f,
                        761.f,         39.f,
                        757.f,         80.f,
                        750.f,         86.f,
                        709.f,         69.f,
                        692.f,         47.f,
                        692.f,         26.f,
                        696.f,         0.f,
                        0.f,           7.f,
                        0.160784319f,  0.1764705926f,
                        0.1882352978f, 255.f,
                        278.f,         599.f,
                        324.f,         554.f,
                        322.f,         557.f,
                        283.f,         599.f,
                        0.f,           9.f,
                        0.160784319f,  0.1764705926f,
                        0.1882352978f, 255.f,
                        758.f,         589.f,
                        753.f,         577.f,
                        755.f,         577.f,
                        762.f,         591.f,
                        756.f,         599.f,
                        754.f,         599.f,
                        0.f,           7.f,
                        0.160784319f,  0.1764705926f,
                        0.1882352978f, 255.f,
                        773.f,         599.f,
                        765.f,         583.f,
                        763.f,         583.f,
                        770.f,         599.f,
                        0.f,           10.f,
                        0.160784319f,  0.1764705926f,
                        0.1882352978f, 255.f,
                        694.f,         507.f,
                        694.f,         498.f,
                        691.f,         498.f,
                        694.f,         509.f,
                        690.f,         519.f,
                        693.f,         521.f,
                        696.f,         507.f,
                        0.f,           9.f,
                        0.160784319f,  0.1764705926f,
                        0.1882352978f, 255.f,
                        215.f,         583.f,
                        256.f,         556.f,
                        253.f,         556.f,
                        216.f,         579.f,
                        198.f,         599.f,
                        200.f,         599.f,
                        0.f,           0.f };


float verticesFB[] = {
    0.842f,  1.052f,  0.842f,  1.649f,  5.296f,  1.649f,  5.595f,  1.855f,  5.913f,  2.028f,  6.233f,
    2.194f,  6.541f,  2.384f,  6.733f,  2.576f,  6.906f,  2.851f,  7.060f,  3.190f,  7.197f,  3.573f,
    7.317f,  3.981f,  7.423f,  4.397f,  7.516f,  4.800f,  7.597f,  5.173f,  7.668f,  5.496f,  7.729f,
    5.751f,  7.782f,  5.918f,  7.815f,  5.974f,  7.876f,  6.075f,  7.981f,  6.274f,  8.143f,  6.622f,
    8.373f,  7.172f,  8.686f,  7.976f,  8.960f,  8.571f,  9.034f,  8.733f,  8.830f,  8.824f,  8.392f,
    8.659f,  7.954f,  8.508f,  7.784f,  8.487f,  7.601f,  8.471f,  7.395f,  8.460f,  7.153f,  8.453f,
    6.867f,  8.449f,  6.116f,  8.449f,  5.630f,  8.451f,  5.057f,  8.452f,  4.384f,  8.453f,  4.144f,
    8.119f,  3.980f,  7.715f,  4.065f,  7.361f,  4.215f,  7.044f,  4.420f,  6.761f,  4.668f,  6.505f,
    4.948f,  6.271f,  5.250f,  6.055f,  5.562f,  5.850f,  5.778f,  5.645f,  6.015f,  5.478f,  6.421f,
    5.367f,  6.742f,  5.271f,  6.921f,  5.178f,  7.105f,  4.836f,  7.123f,  4.472f,  7.005f,  4.183f,
    6.803f,  3.964f,  6.641f,  3.871f,  6.487f,  3.890f,  6.309f,  4.005f,  6.077f,  4.200f,  5.758f,
    4.459f,  5.321f,  4.768f,  4.735f,  5.110f,  4.641f,  5.211f,  4.445f,  5.452f,  4.177f,  5.794f,
    3.868f,  6.198f,  3.548f,  6.624f,  3.246f,  7.033f,  2.993f,  7.387f,  2.819f,  7.644f,  2.753f,
    7.767f,  2.774f,  8.165f,  2.859f,  8.538f,  3.020f,  8.867f,  3.272f,  9.131f,  3.625f,  9.311f,
    4.420f,  9.563f,  5.023f,  9.750f,  5.461f,  9.885f,  5.756f,  9.979f,  5.933f,  10.040f, 6.017f,
    10.090f, 6.032f,  10.140f, 5.946f,  10.470f, 5.873f,  10.810f, 5.830f,  11.140f, 5.835f,  11.460f,
    5.904f,  11.790f, 6.054f,  12.120f, 6.226f,  12.400f, 6.409f,  12.670f, 6.591f,  12.950f, 6.763f,
    13.240f, 6.912f,  13.530f, 7.030f,  13.850f, 7.101f,  14.260f, 7.094f,  14.700f, 7.023f,  15.130f,
    6.902f,  15.510f, 6.747f,  15.810f, 6.570f,  15.970f, 6.403f,  15.930f, 6.092f,  15.770f, 5.735f,
    15.550f, 5.431f,  15.310f, 5.277f,  15.100f, 5.174f,  14.540f, 5.157f,  14.260f, 5.122f,  14.130f,
    4.885f,  13.950f, 4.557f,  13.890f, 4.191f,  13.920f, 3.841f,  14.020f, 3.559f,  14.170f, 3.428f,
    14.300f, 3.353f,  14.480f, 3.322f,  14.740f, 3.318f,  15.080f, 3.326f,  15.520f, 3.332f,  16.100f,
    3.530f,  16.370f, 3.655f,  16.700f, 3.728f,  17.090f, 3.771f,  17.500f, 3.805f,  17.900f, 3.853f,
    18.270f, 3.934f,  18.590f, 4.072f,  18.810f, 4.357f,  19.060f, 4.706f,  19.310f, 5.085f,  19.520f,
    5.459f,  19.680f, 5.794f,  19.750f, 6.056f,  19.710f, 6.208f,  19.540f, 6.733f,  19.540f, 7.059f,
    19.540f, 7.265f,  19.540f, 7.431f,  19.540f, 7.637f,  19.540f, 7.963f,  19.540f, 8.488f,  19.540f,
    8.782f,  19.390f, 9.234f,  19.250f, 9.553f,  19.080f, 9.893f,  18.880f, 10.230f, 18.650f, 10.560f,
    18.420f, 10.840f, 18.190f, 11.070f, 17.990f, 11.230f, 17.820f, 11.700f, 17.160f, 11.970f, 16.690f,
    12.110f, 16.370f, 12.150f, 16.170f, 12.150f, 16.050f, 12.170f, 15.980f, 12.350f, 15.740f, 12.570f,
    15.550f, 12.820f, 15.420f, 13.100f, 15.330f, 13.400f, 15.280f, 13.730f, 15.270f, 14.070f, 15.280f,
    14.430f, 15.330f, 14.800f, 15.390f, 15.180f, 15.470f, 15.560f, 15.560f, 15.950f, 15.650f, 16.330f,
    15.750f, 16.710f, 15.840f, 17.080f, 15.920f, 17.450f, 15.990f, 17.790f, 16.030f, 18.040f, 16.040f,
    18.310f, 16.040f, 18.630f, 16.010f, 18.980f, 15.960f, 19.390f, 15.890f, 19.860f, 15.800f, 20.180f,
    15.740f, 20.450f, 15.700f, 20.700f, 15.690f, 20.940f, 15.720f, 21.190f, 15.800f, 21.470f, 15.930f,
    21.810f, 16.130f, 22.210f, 16.410f, 22.700f, 16.770f, 23.010f, 16.960f, 23.330f, 17.080f, 23.660f,
    17.150f, 23.990f, 17.170f, 24.330f, 17.130f, 24.660f, 17.040f, 24.980f, 16.910f, 25.280f, 16.730f,
    25.560f, 16.510f, 25.800f, 16.300f, 25.950f, 16.120f, 26.040f, 15.890f, 26.120f, 15.490f, 26.210f,
    14.830f, 26.270f, 14.420f, 26.320f, 14.030f, 26.370f, 13.660f, 26.390f, 13.300f, 26.380f, 12.940f,
    26.330f, 12.580f, 26.290f, 12.470f, 26.200f, 12.280f, 26.080f, 12.030f, 25.930f, 11.740f, 25.750f,
    11.400f, 25.550f, 11.030f, 25.340f, 10.650f, 25.120f, 10.270f, 24.900f, 9.897f,  24.680f, 9.544f,
    24.480f, 9.224f,  24.300f, 8.949f,  24.140f, 8.731f,  23.850f, 8.298f,  23.660f, 7.941f,  23.530f,
    7.660f,  23.420f, 7.457f,  23.290f, 7.331f,  23.290f, 6.946f,  23.300f, 6.569f,  23.310f, 6.198f,
    23.340f, 5.830f,  23.380f, 5.501f,  23.300f, 5.389f,  23.050f, 5.526f,  22.840f, 5.731f,  22.680f,
    5.993f,  22.560f, 6.302f,  22.480f, 6.647f,  22.430f, 7.017f,  22.410f, 7.401f,  22.410f, 7.788f,
    22.440f, 8.166f,  22.480f, 8.526f,  22.540f, 8.856f,  22.600f, 9.146f,  22.700f, 9.459f,  22.830f,
    9.787f,  22.990f, 10.120f, 23.160f, 10.460f, 23.330f, 10.790f, 23.480f, 11.110f, 23.620f, 11.400f,
    23.730f, 11.660f, 23.800f, 11.890f, 23.850f, 12.260f, 23.880f, 12.640f, 23.860f, 13.020f, 23.810f,
    13.390f, 23.720f, 13.730f, 23.590f, 14.050f, 23.410f, 14.320f, 23.190f, 14.540f, 22.920f, 14.690f,
    22.620f, 14.790f, 22.300f, 14.850f, 21.970f, 14.880f, 21.640f, 14.880f, 21.310f, 14.880f, 20.980f,
    14.870f, 21.110f, 14.550f, 21.250f, 14.230f, 21.390f, 13.900f, 21.520f, 13.580f, 21.640f, 13.250f,
    21.740f, 12.920f, 21.810f, 12.590f, 21.850f, 12.260f, 21.850f, 11.920f, 21.810f, 11.580f, 21.710f,
    11.240f, 21.550f, 10.880f, 21.320f, 10.540f, 21.040f, 10.220f, 20.740f, 9.924f,  20.430f, 9.648f,
    20.130f, 9.397f,  19.860f, 9.172f,  19.650f, 8.976f,  19.500f, 8.811f,  19.440f, 8.678f,  19.450f,
    8.382f,  19.640f, 7.984f,  19.840f, 7.710f,  20.060f, 7.419f,  20.270f, 7.119f,  20.440f, 6.816f,
    20.520f, 6.520f,  20.480f, 6.237f,  20.350f, 5.983f,  20.160f, 5.736f,  19.930f, 5.491f,  19.670f,
    5.243f,  19.400f, 4.989f,  19.110f, 4.724f,  18.830f, 4.442f,  18.560f, 4.139f,  18.410f, 3.906f,
    18.220f, 3.581f,  18.010f, 3.235f,  17.790f, 2.940f,  17.590f, 2.767f,  17.040f, 2.553f,  16.920f,
    2.444f,  16.820f, 2.143f,  16.630f, 1.806f,  16.420f, 1.766f,  16.020f, 1.824f,  15.580f, 1.951f,
    15.220f, 2.118f,  15.260f, 2.258f,  15.450f, 2.568f,  15.710f, 2.802f,  16.020f, 2.986f,  16.360f,
    3.150f,  16.680f, 3.320f,  16.970f, 3.524f,  17.060f, 3.622f,  17.240f, 3.838f,  17.490f, 4.138f,
    17.780f, 4.490f,  18.080f, 4.859f,  18.370f, 5.213f,  18.610f, 5.518f,  18.770f, 5.741f,  18.840f,
    5.849f,  18.890f, 6.150f,  18.880f, 6.406f,  18.780f, 6.694f,  18.570f, 7.094f,  18.260f, 7.045f,
    18.290f, 6.817f,  18.130f, 6.445f,  17.970f, 6.185f,  17.750f, 5.942f,  17.500f, 5.701f,  17.220f,
    5.447f,  16.940f, 5.167f,  16.670f, 4.846f,  16.510f, 4.623f,  16.340f, 4.356f,  16.170f, 4.058f,
    15.980f, 3.741f,  15.780f, 3.416f,  15.560f, 3.096f,  15.330f, 2.794f,  15.080f, 2.520f,  14.800f,
    2.287f,  14.510f, 2.107f,  14.300f, 1.982f,  14.240f, 1.649f,  27.220f, 1.649f,  27.220f, 1.052f,
    0.842f,  1.052f,  0.842f,  1.649f,  7.541f,  1.649f,  7.700f,  1.941f,  7.767f,  2.217f,  7.837f,
    2.566f,  7.918f,  2.911f,  8.010f,  3.251f,  8.111f,  3.587f,  8.222f,  3.919f,  8.342f,  4.246f,
    8.472f,  4.570f,  8.610f,  4.890f,  8.756f,  5.205f,  8.910f,  5.518f,  9.071f,  5.826f,  9.240f,
    6.131f,  9.415f,  6.432f,  9.597f,  6.730f,  9.785f,  7.025f,  9.979f,  7.317f,  10.180f, 7.605f,
    10.380f, 7.891f,  10.590f, 8.173f,  10.800f, 8.453f,  11.990f, 8.453f,  12.400f, 8.456f,  12.720f,
    8.465f,  12.970f, 8.481f,  13.180f, 8.508f,  13.370f, 8.548f,  13.570f, 8.602f,  13.800f, 8.674f,
    14.090f, 8.765f,  14.460f, 8.878f,  14.780f, 8.817f,  15.180f, 8.588f,  15.470f, 8.326f,  15.600f,
    8.139f,  15.850f, 7.769f,  16.140f, 7.335f,  16.380f, 6.959f,  16.490f, 6.761f,  16.530f, 6.380f,
    16.470f, 6.004f,  16.340f, 5.647f,  16.170f, 5.322f,  16.050f, 5.134f,  15.880f, 4.893f,  15.670f,
    4.617f,  15.430f, 4.323f,  15.200f, 4.030f,  14.970f, 3.755f,  14.760f, 3.515f,  14.690f, 3.464f,
    14.540f, 3.373f,  14.330f, 3.236f,  14.050f, 3.047f,  13.730f, 2.800f,  13.360f, 2.489f,  12.950f,
    2.107f,  12.520f, 1.649f,  0.842f,  1.649f,  27.220f, 1.649f,  27.220f, 1.052f};

// clang-format on

DrawNodeTests::DrawNodeTests()
{
    ADD_TEST_CASE(DrawNodeCircleTest);
    ADD_TEST_CASE(DrawNodeSpLinesTest);
    ADD_TEST_CASE(DrawNodeSpLinesOpenClosedTest);
    ADD_TEST_CASE(DrawNodeAxmolTest2);

#if defined(AX_PLATFORM_PC)
    ADD_TEST_CASE(CandyMixEeffect);
#endif
    ADD_TEST_CASE(DrawNodePictureTest);
    ADD_TEST_CASE(DrawNodeJellyFishTest);
    ADD_TEST_CASE(DrawNodeMorphTest_Polygon);
    ADD_TEST_CASE(DrawNodeMorphTest_SolidPolygon);

    ADD_TEST_CASE(DrawNodePieTest);
    ADD_TEST_CASE(DrawNodeDrawInWrongOrder_Issue1888);

    ADD_TEST_CASE(DrawNodeThicknessTest);
    ADD_TEST_CASE(DrawNodeThicknessStressTest);
    ADD_TEST_CASE(DrawNodeLineDrawTest);
    ADD_TEST_CASE(DrawNodeIssueTester);
    ADD_TEST_CASE(DrawNodeMethodsTest);
}

DrawNodeBaseTest::DrawNodeBaseTest()
{
    auto director = Director::getInstance();
    director->setClearColor(Color::TRANSPARENT);

    origin = director->getVisibleOrigin();
    size   = director->getVisibleSize();
    center = Vec2(origin.x + size.width / 2, origin.y + size.height / 2);

    screen = Director::getInstance()->getVisibleSize();
    sixth  = Vec2(screen.width / 6, screen.height / 6);

    defY  = (int)(center.y + sixth.y);
    defY2 = (int)(center.y - sixth.y);
    dev   = sixth.y;

    pts  = PointArray::create(n);
    pts2 = PointArray::create(n);
    pts->retain();
    pts2->retain();
    for (int i = 0; i < n; ++i)
    {
        pts->insertControlPoint(Vec2(0, 0), i);
        pts2->insertControlPoint(Vec2(0, 0), i);
    }

    generateDataPoints();

    if (!drawNode)
    {
        drawNode = DrawNode::create();
        drawNode->properties.setTransform(true);
        addChild(drawNode);
    }
    menuItemDrawOrder->setFontSize(10);
    menuItemTransform->setFontSize(10);
    menuItemDrawOrder = MenuItemFont::create("drawOrder: false", AX_CALLBACK_1(DrawNodeBaseTest::setDrawOrder, this));
    menuItemTransform = MenuItemFont::create("transform: true", AX_CALLBACK_1(DrawNodeBaseTest::setTransform, this));

    auto menu = Menu::create(menuItemDrawOrder, menuItemTransform, nullptr);
    menu->alignItemsVerticallyWithPadding(4);
    menu->setPosition(Vec2(size.x - 50, size.y / 2 - 20));
    addChild(menu, 1000);
}

void DrawNodeBaseTest::generateDataPoints()
{
    for (int i = 0; i < n; ++i)
    {
        float yy1 = RandomHelper::random_real<float>(defY - dev, defY + dev);
        float yy2 = RandomHelper::random_real<float>(defY2 - dev, defY2 + dev);
        pts->replaceControlPoint(Vec2(margin + i * (screen.width - 3 * margin) / n, yy1), i);
        pts2->replaceControlPoint(Vec2(margin + i * (screen.width - 3 * margin) / n, yy2), i);
    }
}

void DrawNodeBaseTest::setTransform(Object* sender)
{
    bool ret = drawNode->properties.getTransform();
    if (ret)
    {
        menuItemTransform->setString("transform: false");
        drawNode->properties.setTransform(false);
    }
    else
    {
        menuItemTransform->setString("transform: true");
        drawNode->properties.setTransform(true);
    }
}

void DrawNodeBaseTest::setDrawOrder(Object* sender)
{
    bool ret = drawNode->properties.getDrawOrder();
    if (ret)
    {
        menuItemDrawOrder->setString("drawOrder: false");
        drawNode->properties.setDrawOrder(false);
    }
    else
    {
        menuItemDrawOrder->setString("drawOrder: true");
        drawNode->properties.setDrawOrder(true);
    }
}

void DrawNodeBaseTest::listviewCallback(ax::Object* sender, ax::ui::ListView::EventType type)
{
    // clear all text to white
    auto listview = static_cast<ax::ui::ListView*>(sender);
    for (auto&& item : listview->getItems())
    {
        static_cast<ax::ui::Text*>(item)->setColor(ax::Color32::WHITE);
    }
    _currentSeletedItemIndex = (int)listview->getCurSelectedIndex();
    listview->getItem(_currentSeletedItemIndex)->setColor(ax::Color32::RED);
}

void DrawNodeBaseTest::onChangedRadioButtonSelect(ui::RadioButton* radioButton, ui::RadioButton::EventType type)
{
    if (radioButton == nullptr)
        return;

    switch (type)
    {
    case ui::RadioButton::EventType::SELECTED:
    {
        selectedRadioButton = radioButton->getTag();
        break;
    }

    case ui::RadioButton::EventType::UNSELECTED:
    {
        break;
    }
    default:
        break;
    }
}

void DrawNodeBaseTest::update(float dt)
{
    drawNode->clear();
}

string DrawNodeBaseTest::title() const
{
    return "";
}

void DrawNodeBaseTest::drawDirection(const Vec2* vec, const int size, Vec2 offset)
{
    for (size_t i = 0; i < size; i++)
    {
        auto label = Label::createWithTTF(std::to_string(i).c_str(), "fonts/Marker Felt.ttf", 10);
        addChild(label);
        label->setPosition(vec[i] + offset);
    }
}

void DrawNodeBaseTest::changeEndAngle(ax::Object* pSender, ax::ui::Slider::EventType type)
{
    if (type == ax::ui::Slider::EventType::ON_PERCENTAGE_CHANGED)
    {
        slider[sliderType::AngleEnd]      = dynamic_cast<ax::ui::Slider*>(pSender);
        sliderValue[sliderType::AngleEnd] = slider[sliderType::AngleEnd]->getPercent() * 3.6;
        sliderLabel[sliderType::AngleEnd]->setString("endAngle: (" +
                                                     Value(sliderValue[sliderType::AngleEnd]).asString() + ")");
    }
}

void DrawNodeBaseTest::changeStartAngle(ax::Object* pSender, ax::ui::Slider::EventType type)
{
    if (type == ax::ui::Slider::EventType::ON_PERCENTAGE_CHANGED)
    {
        slider[sliderType::AngleStart]      = dynamic_cast<ax::ui::Slider*>(pSender);
        sliderValue[sliderType::AngleStart] = slider[sliderType::AngleStart]->getPercent() * 3.6;
        sliderLabel[sliderType::AngleStart]->setString("startAngle: (" +
                                                       Value(sliderValue[sliderType::AngleStart]).asString() + ")");
    }
}

void DrawNodeBaseTest::changeRotation(ax::Object* pSender, ax::ui::Slider::EventType type)
{
    if (type == ax::ui::Slider::EventType::ON_PERCENTAGE_CHANGED)
    {
        slider[sliderType::Rotation]      = dynamic_cast<ax::ui::Slider*>(pSender);
        sliderValue[sliderType::Rotation] = slider[sliderType::Rotation]->getPercent() * 3.6;
        sliderLabel[sliderType::Rotation]->setString("Rotation: (" +
                                                     Value(sliderValue[sliderType::Rotation]).asString() + ")");
    }
}

void DrawNodeBaseTest::changeThickness(ax::Object* pSender, ax::ui::Slider::EventType type)
{
    if (type == ax::ui::Slider::EventType::ON_PERCENTAGE_CHANGED)
    {
        slider[sliderType::Thickness]      = dynamic_cast<ax::ui::Slider*>(pSender);
        sliderValue[sliderType::Thickness] = slider[sliderType::Thickness]->getPercent() * 0.1;
        sliderLabel[sliderType::Thickness]->setString("Thickness: (" +
                                                      Value(sliderValue[sliderType::Thickness]).asString() + ")");
    }
}

void DrawNodeBaseTest::initSliders()
{
    _currentSeletedItemIndex = 0;

    std::string text[sliderType::sliderTypeLast] = {"AngleStart", "AngleEnd", "Rotation", "Thickness"};

    auto ttfConfig = TTFConfig("fonts/arial.ttf", 5);
    for (int i = 0; i < (sliderType::sliderTypeLast); i++)
    {
        slider[i] = ax::ui::Slider::create();
        slider[i]->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
        slider[i]->loadBarTexture("cocosui/sliderTrack.png");
        slider[i]->loadSlidBallTextures("ccs-res/cocosui/sliderballnormal.png", "ccs-res/cocosui/sliderballpressed.png",
                                        "");
        slider[i]->loadProgressBarTexture("cocosui/sliderProgress.png");
        slider[i]->setPosition(Vec2(size.width - slider[i]->getContentSize().x / 2 - 10, size.height / 6 + i * 16));
        slider[i]->setPercent(sliderValue[i]);

        slider[i]->setEnabled(false);
        slider[i]->setScale(0.5f);
        addChild(slider[i], 20);

        sliderLabel[i] = Label::createWithTTF(ttfConfig, text[i] + ": (" + Value(sliderValue[i]).asString() + ")");
        sliderLabel[i]->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
        sliderLabel[i]->setPosition(slider[i]->getPosition() + Vec2(0, 8));
        addChild(sliderLabel[i], 20);
    }

    slider[sliderType::AngleStart]->addEventListener(AX_CALLBACK_2(DrawNodeBaseTest::changeStartAngle, this));
    slider[sliderType::AngleEnd]->addEventListener(AX_CALLBACK_2(DrawNodeBaseTest::changeEndAngle, this));
    slider[sliderType::Rotation]->addEventListener(AX_CALLBACK_2(DrawNodeBaseTest::changeRotation, this));
    slider[sliderType::Thickness]->addEventListener(AX_CALLBACK_2(DrawNodeBaseTest::changeThickness, this));
}

DrawNodeMorphTest_SolidPolygon::DrawNodeMorphTest_SolidPolygon()
{
    const float coef = 2.0f * (float)M_PI / segments;
    float scaleX     = 1.0f;
    float scaleY     = 1.0f;

    const float angle = 360 / segments;

    for (size_t n = 0; n < 10; n++)
    {

        drawNodeArray[n] = DrawNode::create();
        drawNodeArray[n]->properties.setTransform(true);
        addChild(drawNodeArray[n]);
        drawNodeArray[n]->setPosition(
            Vec2(AXRANDOM_MINUS1_1() * size.width / 4, AXRANDOM_MINUS1_1() * size.height / 4) + Vec2(100, 100));
        color[n] = Color::random().withAlpha(1.0f);
        rad[n]   = 90 + AXRANDOM_0_1() * 10;
        state[n] = (AXRANDOM_0_1() > 0.5f) ? false : true;

        verticesObj1[n]     = new Vec2[segments];  // circle
        verticesObj2[n]     = new Vec2[segments];  // square
        verticesObjMorph[n] = new Vec2[segments];

        for (unsigned int i = 0; i < segments; i++)  //
        {
            float rads = i * coef + angle;
            int radius = 150 + AXRANDOM_MINUS1_1() * 50;
            if (n > 2)
            {
                verticesObj1[n][i].x = radius * cosf(rads) * scaleX + center.x + AXRANDOM_0_1() * 30;
                verticesObj1[n][i].y = radius * sinf(rads) * scaleY + center.y + AXRANDOM_0_1() * 30;
            }
            else
            {
                verticesObj1[n][i].x = radius * cosf(rads) * scaleX + center.x;
                verticesObj1[n][i].y = radius * sinf(rads) * scaleY + center.y;
            }
            verticesObjMorph[n][i] = verticesObj1[n][i];
        }

        // A verticesObj2 is a bunch of vertices along straight lines
        int i       = 0;
        float delta = segments / 4;
        // Left side of verticesObj2
        for (float y = 50; y > -50; y -= delta)
        {
            verticesObj2[n][i++] = center + Vec2(-50, y);
        }
        // top
        for (float x = -50; x < 50; x += delta)
        {
            verticesObj2[n][i++] = center + Vec2(x, -50);
        }
        // Right side
        for (float y = -50; y < 50; y += delta)
        {
            verticesObj2[n][i++] = center + Vec2(50, y);
        }
        // Bottom
        for (float x = 50; x > -50; x -= delta)
        {
            verticesObj2[n][i++] = center + Vec2(x, 50);
        }
    }

    initSliders();
    slider[sliderType::Thickness]->setEnabled(true);

    scheduleUpdate();
}
void DrawNodeMorphTest_SolidPolygon::update(float dt)
{
    for (int n = 0; n < 10; n++)
    {
        drawNodeArray[n]->clear();

        Vec2 v1, v2;
        float totalDistance = 0;
        for (int i = 0; i < segments; i++)
        {
            if (state[n])
            {
                v1 = verticesObj1[n][i];
                v2 = verticesObj2[n][i];
            }
            else
            {
                v2 = verticesObj1[n][i];
                v1 = verticesObj2[n][i];
            }
            v2                     = verticesObjMorph[n][i];
            verticesObjMorph[n][i] = v2.lerp(v1, 0.05f);
            totalDistance += v1.distance(v2);
        }
        // If all the vertices are close, switch shape
        if (totalDistance < 300.0)
        {
            state[n] = !state[n];
        }

        drawNodeArray[n]->properties.setScale(Vec2(0.5f, 0.5f));
        drawNodeArray[n]->drawSolidPolygon(verticesObjMorph[n], segments, color[n], sliderValue[sliderType::Thickness],
                                           Color::YELLOW);
    }
}

void DrawNodeMorphTest_SolidPolygon::onEnter()
{
    for (int i = 0; i < sliderType::sliderTypeLast; i++)
    {
        sliderValue[i] = 1;
        slider[i]->setPercent(sliderValue[i]);
    }

    sliderValue[sliderType::Thickness] = 10;
    slider[sliderType::Thickness]->setPercent(sliderValue[sliderType::Thickness]);

    DrawNodeBaseTest::onEnter();
}

string DrawNodeMorphTest_SolidPolygon::title() const
{
    return "Morphing";
}

string DrawNodeMorphTest_SolidPolygon::subtitle() const
{
    return "Solid Polygons";
}

DrawNodeMorphTest_Polygon::DrawNodeMorphTest_Polygon()
{
    const float coef = 2.0f * (float)M_PI / segments;
    float scaleX     = 1.0f;
    float scaleY     = 1.0f;

    const float angle = 360 / segments;

    for (size_t n = 0; n < 10; n++)
    {
        drawNodeArray[n] = DrawNode::create();
        drawNodeArray[n]->properties.setTransform(true);
        addChild(drawNodeArray[n]);
        drawNodeArray[n]->setPosition(
            Vec2(AXRANDOM_MINUS1_1() * size.width / 4, AXRANDOM_MINUS1_1() * size.height / 4) + Vec2(100, 100));
        color[n] = Color::random().withAlpha(1.0f);
        rad[n]   = 90 + AXRANDOM_0_1() * 10;
        state[n] = (AXRANDOM_0_1() > 0.5f) ? false : true;

        verticesObj1[n]     = new Vec2[segments];  // circle
        verticesObj2[n]     = new Vec2[segments];  // square
        verticesObjMorph[n] = new Vec2[segments];

        for (unsigned int i = 0; i < segments; i++)  //
        {
            float rads = i * coef + angle;
            int radius = 150 + AXRANDOM_MINUS1_1() * 50;
            if (n > 2)
            {
                verticesObj1[n][i].x = radius * cosf(rads) * scaleX + center.x + AXRANDOM_0_1() * 30;
                verticesObj1[n][i].y = radius * sinf(rads) * scaleY + center.y + AXRANDOM_0_1() * 30;
            }
            else
            {
                verticesObj1[n][i].x = radius * cosf(rads) * scaleX + center.x;
                verticesObj1[n][i].y = radius * sinf(rads) * scaleY + center.y;
            }
            verticesObjMorph[n][i] = verticesObj1[n][i];
        }

        // A verticesObj2 is a bunch of vertices along straight lines
        int i       = 0;
        float delta = segments / 4;
        // Left side of verticesObj2
        for (float y = 50; y > -50; y -= delta)
        {
            verticesObj2[n][i++] = center + Vec2(-50, y);
        }
        // top
        for (float x = -50; x < 50; x += delta)
        {
            verticesObj2[n][i++] = center + Vec2(x, -50);
        }
        // Right side
        for (float y = -50; y < 50; y += delta)
        {
            verticesObj2[n][i++] = center + Vec2(50, y);
        }
        // Bottom
        for (float x = 50; x > -50; x -= delta)
        {
            verticesObj2[n][i++] = center + Vec2(x, 50);
        }
    }

    initSliders();
    slider[sliderType::Thickness]->setEnabled(true);

    scheduleUpdate();
}
void DrawNodeMorphTest_Polygon::update(float dt)
{
    for (int n = 0; n < 10; n++)
    {
        drawNodeArray[n]->clear();

        Vec2 v1, v2;
        float totalDistance = 0;
        for (int i = 0; i < segments; i++)
        {
            if (state[n])
            {
                v1 = verticesObj1[n][i];
                v2 = verticesObj2[n][i];
            }
            else
            {
                v2 = verticesObj1[n][i];
                v1 = verticesObj2[n][i];
            }
            v2                     = verticesObjMorph[n][i];
            verticesObjMorph[n][i] = v2.lerp(v1, 0.05f);
            totalDistance += v1.distance(v2);
        }
        // If all the vertices are close, switch shape
        if (totalDistance < 300.0)
        {
            state[n] = !state[n];
        }

        drawNodeArray[n]->properties.setScale(Vec2(0.5f, 0.5f));
        drawNodeArray[n]->drawPoly(verticesObjMorph[n], segments, true, color[n], sliderValue[sliderType::Thickness]);
    }
}

void DrawNodeMorphTest_Polygon::onEnter()
{
    for (int i = 0; i < sliderType::sliderTypeLast; i++)
    {
        sliderValue[i] = 1;
        slider[i]->setPercent(sliderValue[i]);
    }

    sliderValue[sliderType::Thickness] = 10;
    slider[sliderType::Thickness]->setPercent(sliderValue[sliderType::Thickness]);

    DrawNodeBaseTest::onEnter();
}

string DrawNodeMorphTest_Polygon::title() const
{
    return "Morphing";
}

string DrawNodeMorphTest_Polygon::subtitle() const
{
    return "Polygons";
}

DrawNodePictureTest::DrawNodePictureTest()
{
    scheduleUpdate();
}

void DrawNodePictureTest::update(float dt)
{
    DrawNodeBaseTest::update(dt);

    static float rot = 0.1f;
    static int count = 0;
    static bool wait = false;

    drawNode->clear();

    if (!wait)
    {
        rot += 0.05;
        if (rot >= 6)
        {
            rot = count = 0;
            wait        = true;
        }
    }
    else if (count++ > 30)
        wait = false;

    float sph_xx[2326];
    float sph_yy[2326];
    int n = 0;
    for (int i = 0; i < 2326;)  // read data
    {
        sph_xx[n] = verticesHead[i++];
        sph_yy[n] = verticesHead[i++];
        n++;
    }

    float sph_cmb = sph_yy[0];
    int sph_la    = 0;
    do
    {
        Color color =
            Color(sph_xx[sph_la + 1] / 255, sph_yy[sph_la + 1] / 255, sph_xx[sph_la + 2] / 255, sph_yy[sph_la + 2]);
        Vec2* vertices = new Vec2[(int)(sph_cmb - 3)];
        for (int n = 3; n < sph_cmb; n++)
        {
            vertices[n - 3] = Vec2(sph_xx[sph_la + n], sph_yy[sph_la + n]);
        }
        drawNode->setPosition(Vec2(420, 280));
        drawNode->setScale(0.4);
        drawNode->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
        drawNode->setRotation(180);
        drawNode->properties.setCenter(vertices[0]);
        drawNode->properties.setRotation(rot);
        drawNode->drawPolygon(vertices, sph_cmb - 3, color, 0.f, Color::random().withAlpha(0.5f), true);

        sph_la += sph_cmb;
        sph_cmb = sph_yy[sph_la];
    } while (sph_yy[sph_la] != 0);
}

string DrawNodePictureTest::title() const
{
    return "Example: Picture";
}

string DrawNodePictureTest::subtitle() const
{
    return "Properties (Rotation) Test";
}

// orginal source from here: https://forum.lazarus.freepascal.org/index.php/topic,71851.0.html
void DrawNodeJellyFishTest::CalculatePoint(float x, float y, float t, float& px, float& py)
{
    float k, d, e, c, q;
    k  = (4.0 + sin(x / 11.0 + t * 8.0)) * cos(x / 14.0);
    e  = y / 8.0 - 19.0;
    d  = sqrt(k * k + e * e) + sin(y / 9.0 + t * 2.0);
    c  = d * d / 49.0 - t;
    q  = 2.0 * sin(k * 2.0) + sin(y / 17.0) * k * (9.0 + 2.0 * sin(y - d * 3.0));
    px = q + 50.0 * cos(c) + 200.0;
    py = 300 - (q * sin(c) + d * 39.0 - 440.0);
}

void DrawNodeJellyFishTest::UpdateJellyPoints()
{
    static float t = 0;
    float x, y, k, e, d0, d, angle, q, c;

    t += 0.01;
    for (int i = 0; i < NUM_POINTS - 1; i++)
    {
        x = i;
        y = i / 41.0;

        k  = 5 * cos(x / 19) * cos(y / 30);
        e  = y / 8 - 12;
        d0 = sqrt(k * k + e * e);
        d  = (d0 * d0) / 59 + 2;

        angle = atan2(k, e);
        q     = (4 * sin(angle * 9) + 9 * sin(d - t) - (k / d) * (9 + 3 * sin(d * 9 - t * 16)));
        c     = (d * d) / 7 - t;

        dots[i].x = ((q + 50 * cos(c)) * 2 + 600 / 2) / 2;
        dots[i].y = (750 - ((q * sin(c) + d * 45) * 2)) / 2;
    }
}
void DrawNodeJellyFishTest::DrawFrame()
{
    static float t = 0;
    float ii       = 0;
    float px, py;
    px = 0;
    py = 0;
    t += M_PI / 240.0;

    for (int i = 0; i < NUM_POINTS - 1; i++)
    {
        ii = i;
        CalculatePoint(ii, ii / 235.0, t, px, py);
        dots[i] = Vec2(px + 150, py + 50);
    }
    drawNode->drawPoints(dots, NUM_POINTS - 1, Color::GREEN);
    UpdateJellyPoints();
    drawNode->drawPoints(dots, NUM_POINTS - 1, Color::WHITE);
}

DrawNodeJellyFishTest::DrawNodeJellyFishTest()
{
    scheduleUpdate();
}

void DrawNodeJellyFishTest::update(float dt)
{
    DrawNodeBaseTest::update(dt);
    drawNode->clear();
    DrawFrame();
}

string DrawNodeJellyFishTest::title() const
{
    return "Example: JellyFish";
}

string DrawNodeJellyFishTest::subtitle() const
{
    return "drawPoints Test";
}

DrawNodeLineDrawTest::DrawNodeLineDrawTest()
{
    initSliders();
    slider[sliderType::Thickness]->setEnabled(true);

    scheduleUpdate();
}

void DrawNodeLineDrawTest::update(float dt)
{
    DrawNodeBaseTest::update(dt);

    drawNode->clear();

    float segments   = 36.0f;
    int radius       = 100;
    float angle      = 360 / segments;
    const float coef = (float)M_PI / 360;
    for (int i = 0; i < 360;)
    {
        float rads = i * coef;
        i += segments;
        float x = radius * cosf(rads) + center.x;
        float y = radius * sinf(rads) + center.y;

        drawNode->drawLine(center - Vec2(20, 40), Vec2(x, y) - Vec2(20, 40), Color::RED,
                           sliderValue[sliderType::Thickness]);
        drawNode->drawLine(center + Vec2(120, 20), Vec2(x, y) + Vec2(120, 20), Color::BLUE,
                           sliderValue[sliderType::Thickness]);
        drawNode->drawLine(center - Vec2(130, 110), Vec2(x, y) - Vec2(130, 110), Color::GREEN,
                           sliderValue[sliderType::Thickness]);
    }
}

void DrawNodeLineDrawTest::onEnter()
{
    for (int i = 0; i < sliderType::sliderTypeLast; i++)
    {
        sliderValue[i] = 1;
        slider[i]->setPercent(sliderValue[i]);
    }
    sliderValue[sliderType::Thickness] = 10;
    slider[sliderType::Thickness]->setPercent(sliderValue[sliderType::Thickness]);

    DrawNodeBaseTest::onEnter();
}

string DrawNodeLineDrawTest::title() const
{
    return "lineDraw Test";
}

string DrawNodeLineDrawTest::subtitle() const
{
    return "";
}

DrawNodeThicknessTest::DrawNodeThicknessTest()
{
    initSliders();
    slider[sliderType::Thickness]->setEnabled(true);

    scheduleUpdate();
}

void DrawNodeThicknessTest::update(float dt)
{
    DrawNodeBaseTest::update(dt);

    drawNode->clear();

    drawNode->drawCircle(VisibleRect::center(), 60, AX_DEGREES_TO_RADIANS(77), 30, false, Color::GREEN,
                         sliderValue[sliderType::Thickness]);

    drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color::YELLOW,
                       sliderValue[sliderType::Thickness]);
    drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(size.width, size.height - 20), Color::YELLOW,
                       sliderValue[sliderType::Thickness]);

    // drawNode a rectangles
    drawNode->drawRect(Vec2(123, 123), Vec2(227, 227), Color(1, 1, 0, 1), sliderValue[sliderType::Thickness]);
    drawNode->drawRect(Vec2(115, 130), Vec2(130, 115), Vec2(115, 100), Vec2(100, 115), Color::MAGENTA,
                       sliderValue[sliderType::Thickness]);

    drawNode->drawLine(Vec2(200.0f, size.height - 20), Vec2(size.width - 100, size.height - 20), Color::YELLOW,
                       sliderValue[sliderType::Thickness]);
    drawNode->drawLine(Vec2(300.0f, 100.0f), Vec2(size.width - 200, size.height - 120), Color::GREEN,
                       sliderValue[sliderType::Thickness]);

    Vec2 vertices24[] = {
        {45.750000f, 144.375000f},  {75.500000f, 136.875000f},  {75.500000f, 159.125000f},  {100.250000f, 161.375000f},
        {65.500000f, 181.375000f},  {102.250000f, 179.125000f}, {95.000000f, 215.125000f},  {129.331467f, 189.926208f},
        {131.371460f, 206.366196f}, {139.651474f, 192.446198f}, {161.851471f, 200.606201f}, {151.000000f, 220.375000f},
        {110.500000f, 244.375000f}, {153.750000f, 238.125000f}, {142.500000f, 253.875000f}, {220.750000f, 259.375000f},
        {250.500000f, 244.375000f}, {168.750000f, 241.875000f}, {182.250000f, 154.125000f}, {190.250000f, 227.375000f},
        {196.500000f, 197.375000f}, {208.750000f, 210.625000f}, {220.750000f, 194.375000f}, {208.750000f, 176.375000f},
        {253.250000f, 173.875000f}, {243.750000f, 154.125000f}, {213.750000f, 161.375000f}, {202.250000f, 139.875000f},
        {236.000000f, 131.875000f}, {218.500000f, 120.875000f}, {206.500000f, 125.625000f}, {184.500000f, 110.375000f},
        {157.000000f, 108.625000f}, {147.500000f, 96.625000f},  {153.750000f, 85.125000f},  {147.500000f, 75.375000f},
        {126.500000f, 74.125000f},  {110.500000f, 86.625000f},  {127.750000f, 85.125000f},  {135.250000f, 91.125000f},
        {135.250000f, 97.875000f},  {124.000000f, 93.875000f},  {115.500000f, 100.875000f}, {115.500000f, 111.875000f},
        {135.250000f, 108.625000f}, {151.000000f, 124.125000f}, {90.500000f, 131.875000f},  {113.250000f, 120.875000f},
        {88.000000f, 116.875000f},  {106.000000f, 103.875000f}, {88.000000f, 97.875000f},
    };
    drawNode->drawPolygon(vertices24, sizeof(vertices24) / sizeof(vertices24[0]), Color::TRANSPARENT,
                          sliderValue[sliderType::Thickness] / 2, Color::RED);

    // open random color poly
    Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f),
                       Vec2(50.0f, 100.0f)};
    drawNode->drawPoly(vertices, 5, false, Color::random().withAlpha(1.0f), sliderValue[sliderType::Thickness]);

    // closed random color poly
    Vec2 vertices2[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)};
    drawNode->drawPoly(vertices2, 3, true, Color::random().withAlpha(1.0f), sliderValue[sliderType::Thickness]);

    // drawNode some beziers
    drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10),
                             Vec2(size.width - 10, size.height - 10), 10, Color::BLUE,
                             sliderValue[sliderType::Thickness]);

    drawNode->drawQuadBezier(Vec2(0.0f + 100, size.height - 100), Vec2(size.width / 2, size.height / 2),
                             Vec2(size.width - 100, size.height - 100), 50, Color::RED,
                             sliderValue[sliderType::Thickness]);

    drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50),
                              Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(),
                              100, Color::WHITE, sliderValue[sliderType::Thickness]);

    drawNode->drawCubicBezier(Vec2(size.width - 250, 40.0f), Vec2(size.width - 70, 100.0f),
                              Vec2(size.width - 30, 250.0f), Vec2(size.width - 10, size.height - 50), 10, Color::GRAY,
                              sliderValue[sliderType::Thickness]);

    auto array = ax::PointArray::create(20);
    array->addControlPoint(Vec2(0.0f, 0.0f));
    array->addControlPoint(Vec2(80.0f, 80.0f));
    array->addControlPoint(Vec2(size.width - 80, 80.0f));
    array->addControlPoint(Vec2(size.width - 80, size.height - 80));
    array->addControlPoint(Vec2(80.0f, size.height - 80));
    array->addControlPoint(Vec2(80.0f, 80.0f));
    array->addControlPoint(Vec2(size.width / 2, size.height / 2));
    drawNode->drawCardinalSpline(array, 0.5f, 50, Color::MAGENTA, sliderValue[sliderType::Thickness]);

    auto array2 = ax::PointArray::create(20);
    array2->addControlPoint(Vec2(size.width / 2, 30.0f));
    array2->addControlPoint(Vec2(size.width - 80, 30.0f));
    array2->addControlPoint(Vec2(size.width - 80, size.height - 80));
    array2->addControlPoint(Vec2(size.width / 2, size.height - 80));
    array2->addControlPoint(Vec2(size.width / 2, 30.0f));
    drawNode->drawCatmullRom(array2, 50, Color::ORANGE, sliderValue[sliderType::Thickness]);

    auto s = Director::getInstance()->getCanvasSize();

    drawNode->drawPoint(Vec2(s.width / 2 - 120, s.height / 2 - 120), 10,
                        Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    drawNode->drawPoint(Vec2(s.width / 2 + 120, s.height / 2 + 120), 10,
                        Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    // drawNode 4 small points
    Vec2 position[] = {Vec2(60, 60), Vec2(70, 70), Vec2(60, 70), Vec2(70, 60)};
    drawNode->drawPoints(position, 4, 5, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    // drawNode a line
    drawNode->drawLine(Vec2(0, 0), Vec2(s.width, s.height), Color(1.0, 0.0, 0.0, 0.5));

    // drawNode a rectangle
    drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color(1, 1, 0, 1));

    drawNode->drawRect(Vec2(15, 30), Vec2(30, 15), Vec2(15, 0), Vec2(0, 15),
                       Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    // drawNode a circle
    drawNode->drawCircle(VisibleRect::center() + Vec2(140, 0), 100, AX_DEGREES_TO_RADIANS(90), 50, true, 1.0f, 2.0f,
                         Color(1.0f, 0.0f, 0.0f, 0.5f));

    drawNode->drawCircle(VisibleRect::center() - Vec2(140, 0), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
                         Color::random().withAlpha(1.0f));

    // drawNode some beziers
    drawNode->drawQuadBezier(Vec2(s.width - 150, s.height - 150), Vec2(s.width - 70, s.height - 10),
                             Vec2(s.width - 10, s.height - 10), 10,
                             Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    drawNode->drawQuadBezier(Vec2(0.0f, s.height), Vec2(s.width / 2, s.height / 2), Vec2(s.width, s.height), 50,
                             Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50),
                              Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(),
                              100, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    drawNode->drawCubicBezier(Vec2(s.width - 250, 40.0f), Vec2(s.width - 70, 100.0f), Vec2(s.width - 30, 250.0f),
                              Vec2(s.width - 10, s.height - 50), 10,
                              Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    auto array3 = PointArray::create(20);
    array3->addControlPoint(Vec2(0.0f, 0.0f));
    array3->addControlPoint(Vec2(80.0f, 80.0f));
    array3->addControlPoint(Vec2(s.width - 80, 80.0f));
    array3->addControlPoint(Vec2(s.width - 80, s.height - 80));
    array3->addControlPoint(Vec2(80.0f, s.height - 80));
    array3->addControlPoint(Vec2(80.0f, 80.0f));
    array3->addControlPoint(Vec2(s.width / 2, s.height / 2));
    drawNode->drawCardinalSpline(array3, 0.5f, 50, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    auto array4 = PointArray::create(20);
    array4->addControlPoint(Vec2(s.width / 2, 30.0f));
    array4->addControlPoint(Vec2(s.width - 80, 30.0f));
    array4->addControlPoint(Vec2(s.width - 80, s.height - 80));
    array4->addControlPoint(Vec2(s.width / 2, s.height - 80));
    array4->addControlPoint(Vec2(s.width / 2, 30.0f));
    drawNode->drawCatmullRom(array4, 50, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    // open random color poly
    Vec2 verticesA[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f),
                        Vec2(50.0f, 100.0f)};
    drawNode->drawPoly(verticesA, 5, false, Color::random().withAlpha(1.0f));

    // closed random color poly
    Vec2 verticesB[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)};
    drawNode->drawPoly(verticesB, 3, true, Color::random().withAlpha(1.0f));

    // drawNode 10 circles
    for (int i = 0; i < 10; i++)
    {
        drawNode->drawDot(Vec2(s.width / 2, s.height / 2), 10.f * (10 - i), Color::random().withAlpha(1.0f));
    }

    // drawNode polygons
    Vec2 points[] = {Vec2(s.height / 4, 0.0f), Vec2(s.width, s.height / 5), Vec2(s.width / 3 * 2, s.height)};
    drawNode->drawPolygon(points, sizeof(points) / sizeof(points[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 4,
                          Color(0.0f, 0.0f, 1.0f, 0.5f));

    // star poly (triggers buggs)
    {
        const float o = 80;
        const float w = 20;
        const float h = 50;
        Vec2 star[]   = {
            Vec2(o + w, o - h), Vec2(o + w * 2, o),                  // lower spike
            Vec2(o + w * 2 + h, o + w), Vec2(o + w * 2, o + w * 2),  // right spike
            //     {o +w, o+w*2+h}, {o,o+w*2},        // top spike
            //     {o -h, o+w}, {o,o}, // left spike
        };

        drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1,
                              Color(0.0f, 0.0f, 1.0f, 1.0f));
    }

    // star poly (doesn't trigger bug... order is important un tesselation is supported.
    {
        const float o = 180;
        const float w = 20;
        const float h = 50;
        Vec2 star[]   = {
            Vec2(o, o),
            Vec2(o + w, o - h),
            Vec2(o + w * 2, o),  // lower spike
            Vec2(o + w * 2 + h, o + w),
            Vec2(o + w * 2, o + w * 2),  // right spike
            Vec2(o + w, o + w * 2 + h),
            Vec2(o, o + w * 2),  // top spike
            Vec2(o - h, o + w),  // left spike
        };

        drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1,
                              Color(0.0f, 0.0f, 1.0f, 1.0f));
    }

    // drawNode a solid polygon
    Vec2 vertices3[] = {Vec2(60.0f, 160.0f), Vec2(70.0f, 190.0f), Vec2(100.0f, 190.0f), Vec2(90.0f, 160.0f)};
    drawNode->drawSolidPoly(vertices3, 4, Color(1.0f, 1.0f, 0.0f, 1.0f));

    // drawNode a solid rectangle
    drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color(1.0f, 1.0f, 0.0f, 1.0f));

    // drawNode a solid circle
    drawNode->drawSolidCircle(VisibleRect::center() + Vec2(140.0f, 0.0f), 40, AX_DEGREES_TO_RADIANS(90), 50, 2.0f, 2.0f,
                              Color(0.0f, 1.0f, 0.0f, 1.0f));

    // drawNode segment
    drawNode->drawSegment(Vec2(20.0f, s.height), Vec2(20.0f, s.height / 2), 10, Color(0.0f, 1.0f, 0.0f, 1.0f));

    drawNode->drawSegment(Vec2(10.0f, s.height / 2), Vec2(s.width / 2, s.height / 2), 40,
                          Color(1.0f, 0.0f, 1.0f, 0.5f));

    // drawNode triangle
    drawNode->drawTriangle(Vec2(10.0f, 10.0f), Vec2(70.0f, 30.0f), Vec2(100.0f, 140.0f),
                           Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    for (int i = 0; i < 100; i++)
    {
        drawNode->drawPoint(Vec2(i * 7.0f, 5.0f), (float)i / 5 + 1, Color::random().withAlpha(1.0f));
    }

    drawNode->drawLine(Vec2(0.0f, s.height), Vec2(s.width, s.height - 20), Color::YELLOW);
    drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(s.width, s.height - 20), Color::YELLOW);

    drawNode->runAction(RepeatForever::create(Sequence::create(FadeIn::create(1.2f), FadeOut::create(1.2f), nullptr)));
}

void DrawNodeThicknessTest::onEnter()
{
    for (int i = 0; i < sliderType::sliderTypeLast; i++)
    {
        sliderValue[i] = 1;
        slider[i]->setPercent(sliderValue[i]);
    }
    // sliderValue[sliderType::Counter] = 100;
    // slider[sliderType::Counter]->setPercent(sliderValue[sliderType::Counter]);
    sliderValue[sliderType::Thickness] = 10;
    slider[sliderType::Thickness]->setPercent(sliderValue[sliderType::Thickness]);

    DrawNodeBaseTest::onEnter();
}

string DrawNodeThicknessTest::title() const
{
    return "Thickness Test";
}

string DrawNodeThicknessTest::subtitle() const
{
    return "";
}

DrawNodeThicknessStressTest::DrawNodeThicknessStressTest()
{
    initSliders();
    slider[sliderType::Thickness]->setEnabled(true);

    scheduleUpdate();
}

void DrawNodeThicknessStressTest::update(float dt)
{
    static float negativThickness = -99999999.9999;
    DrawNodeBaseTest::update(dt);

    drawNode->clear();

    drawNode->drawCircle(VisibleRect::center(), 60, AX_DEGREES_TO_RADIANS(77), 30, false, Color::GREEN,
                         negativThickness);

    drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color::YELLOW, negativThickness);

    // drawNode a rectangles
    drawNode->drawRect(Vec2(123, 123), Vec2(227, 227), Color(1, 1, 0, 1), negativThickness);

    Vec2 vertices24[] = {
        {45.750000f, 144.375000f},  {75.500000f, 136.875000f},  {75.500000f, 159.125000f},  {100.250000f, 161.375000f},
        {65.500000f, 181.375000f},  {102.250000f, 179.125000f}, {95.000000f, 215.125000f},  {129.331467f, 189.926208f},
        {131.371460f, 206.366196f}, {139.651474f, 192.446198f}, {161.851471f, 200.606201f}, {151.000000f, 220.375000f},
        {110.500000f, 244.375000f}, {153.750000f, 238.125000f}, {142.500000f, 253.875000f}, {220.750000f, 259.375000f},
        {250.500000f, 244.375000f}, {168.750000f, 241.875000f}, {182.250000f, 154.125000f}, {190.250000f, 227.375000f},
        {196.500000f, 197.375000f}, {208.750000f, 210.625000f}, {220.750000f, 194.375000f}, {208.750000f, 176.375000f},
        {253.250000f, 173.875000f}, {243.750000f, 154.125000f}, {213.750000f, 161.375000f}, {202.250000f, 139.875000f},
        {236.000000f, 131.875000f}, {218.500000f, 120.875000f}, {206.500000f, 125.625000f}, {184.500000f, 110.375000f},
        {157.000000f, 108.625000f}, {147.500000f, 96.625000f},  {153.750000f, 85.125000f},  {147.500000f, 75.375000f},
        {126.500000f, 74.125000f},  {110.500000f, 86.625000f},  {127.750000f, 85.125000f},  {135.250000f, 91.125000f},
        {135.250000f, 97.875000f},  {124.000000f, 93.875000f},  {115.500000f, 100.875000f}, {115.500000f, 111.875000f},
        {135.250000f, 108.625000f}, {151.000000f, 124.125000f}, {90.500000f, 131.875000f},  {113.250000f, 120.875000f},
        {88.000000f, 116.875000f},  {106.000000f, 103.875000f}, {88.000000f, 97.875000f},
    };
    drawNode->drawPolygon(vertices24, sizeof(vertices24) / sizeof(vertices24[0]), Color::TRANSPARENT, negativThickness,
                          Color::RED);

    // open random color poly
    Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f),
                       Vec2(50.0f, 100.0f)};
    drawNode->drawPoly(vertices, 5, false, Color::random().withAlpha(1.0f), negativThickness);

    // closed random color poly
    Vec2 vertices2[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)};
    drawNode->drawPoly(vertices2, 3, true, Color::random().withAlpha(1.0f), negativThickness);

    // drawNode some beziers
    drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10),
                             Vec2(size.width - 10, size.height - 10), 10, Color::BLUE, negativThickness);

    drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50),
                              Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(),
                              100, Color::WHITE, negativThickness);

    auto array = ax::PointArray::create(20);
    array->addControlPoint(Vec2(0.0f, 0.0f));
    array->addControlPoint(Vec2(80.0f, 80.0f));
    array->addControlPoint(Vec2(size.width - 80, 80.0f));
    array->addControlPoint(Vec2(size.width - 80, size.height - 80));
    array->addControlPoint(Vec2(80.0f, size.height - 80));
    array->addControlPoint(Vec2(80.0f, 80.0f));
    array->addControlPoint(Vec2(size.width / 2, size.height / 2));
    drawNode->drawCardinalSpline(array, 0.5f, 50, Color::MAGENTA, negativThickness);

    auto array2 = ax::PointArray::create(20);
    array2->addControlPoint(Vec2(size.width / 2, 30.0f));
    array2->addControlPoint(Vec2(size.width - 80, 30.0f));
    array2->addControlPoint(Vec2(size.width - 80, size.height - 80));
    array2->addControlPoint(Vec2(size.width / 2, size.height - 80));
    array2->addControlPoint(Vec2(size.width / 2, 30.0f));
    drawNode->drawCatmullRom(array2, 50, Color::ORANGE, negativThickness);

    auto s = Director::getInstance()->getCanvasSize();

    drawNode->drawPoint(Vec2(s.width / 2 - 120, s.height / 2 - 120), negativThickness,
                        Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    // drawNode 4 small points
    Vec2 position[] = {Vec2(60, 60), Vec2(70, 70), Vec2(60, 70), Vec2(70, 60)};
    drawNode->drawPoints(position, 4, 5, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1), DrawNode::Rect);

    Vec2 position1[] = {Vec2(100, 100), Vec2(170, 170), Vec2(260, 170), Vec2(170, 260)};
    drawNode->drawPoints(position1, 4, 25, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1), DrawNode::Rect);

    // drawNode a rectangle
    drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color(1, 1, 0, 1), negativThickness);

    // drawNode 10 circles
    for (int i = 0; i < 10; i++)
    {
        drawNode->drawDot(Vec2(s.width / 2, s.height / 2), negativThickness, Color::random().withAlpha(1.0f));
    }

    // star poly (doesn't trigger bug... order is important un tesselation is supported.
    {
        const float o = 180;
        const float w = 20;
        const float h = 50;
        Vec2 star[]   = {
            Vec2(o, o),
            Vec2(o + w, o - h),
            Vec2(o + w * 2, o),  // lower spike
            Vec2(o + w * 2 + h, o + w),
            Vec2(o + w * 2, o + w * 2),  // right spike
            Vec2(o + w, o + w * 2 + h),
            Vec2(o, o + w * 2),  // top spike
            Vec2(o - h, o + w),  // left spike
        };

        drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1,
                              Color(0.0f, 0.0f, 1.0f, 1.0f));
    }

    // drawNode a solid polygon
    Vec2 vertices3[] = {Vec2(60.0f, 160.0f), Vec2(70.0f, 190.0f), Vec2(100.0f, 190.0f), Vec2(90.0f, 160.0f)};
    drawNode->drawSolidPoly(vertices3, 4, Color(1.0f, 1.0f, 0.0f, 1.0f));

    // drawNode a solid rectangle
    drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color(1.0f, 1.0f, 0.0f, 1.0f));

    // drawNode a solid circle
    drawNode->drawSolidCircle(VisibleRect::center() + Vec2(140.0f, 0.0f), 40, AX_DEGREES_TO_RADIANS(90), 50, 2.0f, 2.0f,
                              Color(0.0f, 1.0f, 0.0f, 1.0f));

    // drawNode segment
    drawNode->drawSegment(Vec2(20.0f, s.height), Vec2(20.0f, s.height / 2), 10, Color(0.0f, 1.0f, 0.0f, 1.0f));

    // drawNode triangle
    drawNode->drawTriangle(Vec2(10.0f, 10.0f), Vec2(70.0f, 30.0f), Vec2(100.0f, 140.0f),
                           Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));
}

void DrawNodeThicknessStressTest::onEnter()
{
    for (int i = 0; i < sliderType::sliderTypeLast; i++)
    {
        sliderValue[i] = 1;
        slider[i]->setPercent(sliderValue[i]);
    }

    sliderValue[sliderType::Thickness] = 5;
    slider[sliderType::Thickness]->setPercent(sliderValue[sliderType::Thickness]);

    DrawNodeBaseTest::onEnter();
}

string DrawNodeThicknessStressTest::title() const
{
    return "Thickness Stress Test";
}

string DrawNodeThicknessStressTest::subtitle() const
{
    return "";
}

DrawNodePieTest::DrawNodePieTest()
{
    initSliders();
    slider[sliderType::AngleStart]->setEnabled(true);
    slider[sliderType::AngleEnd]->setEnabled(true);
    slider[sliderType::Rotation]->setEnabled(true);
    slider[sliderType::Thickness]->setEnabled(true);

    scheduleUpdate();
}

void DrawNodePieTest::update(float dt)
{
    DrawNodeBaseTest::update(dt);

    drawNode->clear();

    // Filled
    drawNode->drawPie(VisibleRect::center() - Vec2(190.0f, -35.0f), 40, sliderValue[sliderType::Rotation],
                      sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, Color::RED,
                      Color::BLUE, drawNode->DrawMode::Fill, sliderValue[sliderType::Thickness]);

    // Outlined
    drawNode->drawPie(VisibleRect::center() - Vec2(95.0f, -35.0f), 40, sliderValue[sliderType::Rotation],
                      sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f,
                      Color::TRANSPARENT, Color::BLUE, drawNode->DrawMode::Outline, sliderValue[sliderType::Thickness]);

    // Line
    drawNode->drawPie(VisibleRect::center() + Vec2(0.0f, 35.0f), 40, sliderValue[sliderType::Rotation],
                      sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f,
                      Color::TRANSPARENT, Color::BLUE, drawNode->DrawMode::Line, sliderValue[sliderType::Thickness]);

    //  Semi
    drawNode->drawPie(VisibleRect::center() + Vec2(95.0f, 35.0f), 40, sliderValue[sliderType::Rotation],
                      sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f,
                      Color::TRANSPARENT, Color::BLUE, drawNode->DrawMode::Semi, sliderValue[sliderType::Thickness]);

    // Semi (Filled)
    drawNode->drawPie(VisibleRect::center() + Vec2(190.0f, 35.0f), 40, sliderValue[sliderType::Rotation],
                      sliderValue[sliderType::AngleStart], sliderValue[sliderType::AngleEnd], 1.0f, 1.0f, Color::RED,
                      Color::BLUE, drawNode->DrawMode::Semi, sliderValue[sliderType::Thickness]);
}

void DrawNodePieTest::onEnter()
{
    for (int i = 0; i < sliderType::sliderTypeLast; i++)
    {
        sliderValue[i] = 1;
        slider[i]->setPercent(sliderValue[i]);
    }

    sliderValue[sliderType::AngleStart] = 10;
    slider[sliderType::AngleStart]->setPercent(sliderValue[sliderType::AngleStart]);

    sliderValue[sliderType::AngleEnd] = 100;
    slider[sliderType::AngleEnd]->setPercent(sliderValue[sliderType::AngleEnd]);

    sliderValue[sliderType::Rotation] = 10;
    slider[sliderType::Rotation]->setPercent(sliderValue[sliderType::Rotation]);

    sliderValue[sliderType::Thickness] = 10;
    slider[sliderType::Thickness]->setPercent(sliderValue[sliderType::Thickness]);

    DrawNodeBaseTest::onEnter();
}

string DrawNodePieTest::title() const
{
    return "drawPie";
}

string DrawNodePieTest::subtitle() const
{
    return "Filled, Outlined, Line, Semi, Semi (Filled)";
}

DrawNodeMethodsTest::DrawNodeMethodsTest()
{
    static const float BUTTON_WIDTH = 30;
    static float startPosX          = 0;

    auto listview = createListView();
    listview->setPosition(Vec2(0.0f, 40.0f));
    addChild(listview);

    drawNode->setScale(0.5);
    drawNode->setPosition(center);

    initSliders();
    slider[sliderType::Thickness]->setEnabled(true);
    slider[sliderType::Rotation]->setEnabled(true);

    labelRound = Label::createWithTTF("DrawNode::Round", "fonts/arial.ttf", 12);
    addChild(labelRound, 1);
    labelRound->setVisible(false);
    labelSquare = Label::createWithTTF("DrawNode::Square", "fonts/arial.ttf", 12);
    addChild(labelSquare, 1);
    labelSquare->setVisible(false);
    labelButt = Label::createWithTTF("DrawNode::Butt", "fonts/arial.ttf", 12);
    addChild(labelButt, 1);
    labelButt->setVisible(false);

    scheduleUpdate();
}

ax::ui::ListView* DrawNodeMethodsTest::createListView()
{
    auto listview    = ax::ui::ListView::create();
    Vec2 contentSize = {0, 0};
    for (size_t i = 0; i < (drawMethodes::LAST); i++)
    {
        auto ui = ax::ui::Text::create();
        ui->setString(drawMethods[i].c_str());
        contentSize.x = MAX(ui->getContentSize().x, contentSize.x);
        contentSize.y = MAX(ui->getContentSize().y, contentSize.y);
        ui->setTouchEnabled(true);
        listview->pushBackCustomItem(ui);
    }

    listview->setContentSize(contentSize * (drawMethodes::LAST));
    listview->setCurSelectedIndex(0);
    listview->setTouchEnabled(true);
    listview->addEventListener(
        (ui::ListView::ccListViewCallback)AX_CALLBACK_2(DrawNodeBaseTest::listviewCallback, this));
    listview->setTag(100);

    listview->getItem(_currentSeletedItemIndex)->setColor(Color32::RED);

    return listview;
}

void DrawNodeMethodsTest::update(float dt)
{
    drawAll();
}

void DrawNodeMethodsTest::onEnter()
{
    for (int i = 0; i < sliderType::sliderTypeLast; i++)
    {
        sliderValue[i] = 1;
        slider[i]->setPercent(sliderValue[i]);
    }
    sliderValue[sliderType::Thickness] = 10;
    slider[sliderType::Thickness]->setPercent(sliderValue[sliderType::Thickness]);
    sliderValue[sliderType::Rotation] = 0;
    slider[sliderType::Rotation]->setPercent(sliderValue[sliderType::Rotation]);

    DrawNodeBaseTest::onEnter();
}

std::string DrawNodeMethodsTest::title() const
{
    return "DrawNode Stress Tests";
}

string DrawNodeMethodsTest::subtitle() const
{
    return "";
}

void DrawNodeMethodsTest::drawAll()
{
    static float rotation = 0.1f;
    rotation += 0.1;
    if (rotation > 62.8f)
    {
        rotation = 0.0f;
    }

    drawNode->clear();
    drawNode->properties.setDefaultValues();

    labelRound->setVisible(false);
    labelSquare->setVisible(false);
    labelButt->setVisible(false);

    switch (_currentSeletedItemIndex)
    {
    case drawMethodes::Line:
    {
        for (int i = 0; i < 100; i++)
        {
            drawNode->drawLine(Vec2(-size.x / 2, -size.y / 2 + i * 4), Vec2(size.x - 50, -size.y / 2 + i * 4),
                               Color::random().withAlpha(1.0f), sliderValue[sliderType::Thickness]);
        }

        break;
    }
    case drawMethodes::Rect:
    {
        Vec2 rec;
        for (int i = 0; i < 100; i++)
        {
            rec = Vec2(i * 3, i * 3);
            drawNode->drawRect(center / 2 - rec, center / 2 + rec, Color::random().withAlpha(1.0f),
                               sliderValue[sliderType::Thickness]);
        }

        break;
    }
    case drawMethodes::Circle:
    {
        for (int i = 0; i < 100; i++)
        {
            drawNode->drawCircle(VisibleRect::center(), 3 * i, AX_DEGREES_TO_RADIANS(90), i, false, 1.0f, 1.0f,
                                 Color::random().withAlpha(1.0f), sliderValue[sliderType::Thickness]);
        }

        break;
    }
    case drawMethodes::QuadBezier:
    {
        drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10),
                                 Vec2(size.width - 10, size.height - 10), 10, Color::BLUE,
                                 sliderValue[sliderType::Thickness]);
        drawNode->drawQuadBezier(Vec2(0.0f + 100, size.height - 100), Vec2(size.width / 2, size.height / 2),
                                 Vec2(size.width - 100, size.height - 100), 50, Color::RED,
                                 sliderValue[sliderType::Thickness]);

        for (int i = 0; i < 360;)
        {
            Vec2 p1 = pts->getControlPointAtIndex(i);
            Vec2 p2 = pts->getControlPointAtIndex(i++);
            Vec2 p3 = pts->getControlPointAtIndex(i);

            drawNode->properties.setPosition(Vec2(-100, -100));
            drawNode->drawQuadBezier(p1, p2, p3, 30, Color::RED, sliderValue[sliderType::Thickness]);
        }

        for (int i = 0; i < 360;)
        {
            Vec2 p1 = pts2->getControlPointAtIndex(i);
            Vec2 p2 = pts2->getControlPointAtIndex(i++);
            Vec2 p3 = pts2->getControlPointAtIndex(i);

            drawNode->properties.setPosition(Vec2(-100, -100));
            drawNode->drawQuadBezier(p1, p2, p3, 30, Color::GREEN, sliderValue[sliderType::Thickness]);
        }

        break;
    }
    case drawMethodes::CubicBezier:
    {
        drawNode->drawCubicBezier(VisibleRect::center(),
                                  Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50),
                                  Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50),
                                  VisibleRect::right(), 20, Color::WHITE, sliderValue[sliderType::Thickness]);
        drawNode->drawCubicBezier(Vec2(size.width - 250, 40.0f), Vec2(size.width - 70, 100.0f),
                                  Vec2(size.width - 30, 250.0f), Vec2(size.width - 10, size.height - 50), 20,
                                  Color::GRAY, sliderValue[sliderType::Thickness]);

        for (int i = 0; i < 360;)
        {
            Vec2 p1 = pts->getControlPointAtIndex(i);
            Vec2 p2 = pts->getControlPointAtIndex(i++);
            Vec2 p3 = pts->getControlPointAtIndex(i++);
            Vec2 p4 = pts->getControlPointAtIndex(i);
            drawNode->properties.setPosition(Vec2(-100, -100));
            drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color::RED, sliderValue[sliderType::Thickness]);
        }

        for (int i = 0; i < 360;)
        {
            Vec2 p1 = pts2->getControlPointAtIndex(i);
            Vec2 p2 = pts2->getControlPointAtIndex(i++);
            Vec2 p3 = pts2->getControlPointAtIndex(i++);
            Vec2 p4 = pts2->getControlPointAtIndex(i);
            drawNode->properties.setPosition(Vec2(-100, -100));
            drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color::GREEN, sliderValue[sliderType::Thickness]);
        }

        break;
    }
    case drawMethodes::CardinalSpline:
    {

        auto array = ax::PointArray::create(7);
        array->addControlPoint(Vec2(0.0f, 0.0f));
        array->addControlPoint(Vec2(80.0f, 80.0f));
        array->addControlPoint(Vec2(size.width - 80, 80.0f));
        array->addControlPoint(Vec2(size.width - 80, size.height - 80));
        array->addControlPoint(Vec2(80.0f, size.height - 80));
        array->addControlPoint(Vec2(80.0f, 80.0f));
        array->addControlPoint(Vec2(size.width / 2, size.height / 2));
        drawNode->drawCardinalSpline(array, 0.5f, 120, Color::MAGENTA, sliderValue[sliderType::Thickness]);

        auto array2 = ax::PointArray::create(5);
        array2->addControlPoint(Vec2(size.width / 2, 80.0f));
        array2->addControlPoint(Vec2(size.width - 80, 80.0f));
        array2->addControlPoint(Vec2(size.width - 80, size.height - 80));
        array2->addControlPoint(Vec2(size.width / 2, size.height - 80));
        array2->addControlPoint(Vec2(size.width / 2, 80.0f));
        drawNode->drawCardinalSpline(array2, 5.0f, 120, Color::ORANGE, sliderValue[sliderType::Thickness]);

        drawNode->properties.setPosition(Vec2(-100, -100));
        drawNode->drawCardinalSpline(pts, 0.001f, 360, Color::RED, sliderValue[sliderType::Thickness]);
        drawNode->drawCardinalSpline(pts2, 0.001f, 360, Color::GREEN, sliderValue[sliderType::Thickness]);

        break;
    }
    case drawMethodes::CatmullRom:
    {
        auto array2 = ax::PointArray::create(5);
        array2->addControlPoint(Vec2(size.width / 2, 80.0f));
        array2->addControlPoint(Vec2(size.width - 80, 80.0f));
        array2->addControlPoint(Vec2(size.width - 80, size.height - 80));
        array2->addControlPoint(Vec2(size.width / 2, size.height - 80));
        array2->addControlPoint(Vec2(size.width / 2, 80.0f));
        drawNode->drawCatmullRom(array2, 20, Color::ORANGE, sliderValue[sliderType::Thickness]);

        auto array = ax::PointArray::create(7);
        array->addControlPoint(Vec2(0.0f, 0.0f));
        array->addControlPoint(Vec2(80.0f, 80.0f));
        array->addControlPoint(Vec2(size.width - 80, 80.0f));
        array->addControlPoint(Vec2(size.width - 80, size.height - 80));
        array->addControlPoint(Vec2(80.0f, size.height - 80));
        array->addControlPoint(Vec2(80.0f, 80.0f));
        array->addControlPoint(Vec2(size.width / 2, size.height / 2));
        drawNode->drawCatmullRom(array, 20, Color::MAGENTA, sliderValue[sliderType::Thickness]);

        drawNode->properties.setPosition(Vec2(-100, -100));
        drawNode->drawCatmullRom(pts, 360, Color::RED, sliderValue[sliderType::Thickness]);
        drawNode->drawCatmullRom(pts2, 360, Color::GREEN, sliderValue[sliderType::Thickness]);

        break;
    }
    case drawMethodes::Poly:
    {
        Vec2 vertices[5] = {{0.0f, 0.0f}, {50.0f, 50.0f}, {100.0f, 50.0f}, {100.0f, 100.0f}, {50.0f, 100.0f}};
        drawNode->properties.setPosition(Vec2(-200, -300));
        drawNode->drawPoly(vertices, 5, false, Color::BLUE, sliderValue[sliderType::Thickness]);

        Vec2 vertices2[3] = {{30.0f, 130.0f}, {30.0f, 230.0f}, {50.0f, 200.0f}};
        drawNode->drawPoly(vertices2, 3, true, Color::GREEN, sliderValue[sliderType::Thickness]);

        drawNode->properties.setDefaultValues();
        drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::RED,
                           sliderValue[sliderType::Thickness]);

        drawNode->properties.setPosition(Vec2(0, -300));
        drawNode->properties.setRotation(sliderValue[sliderType::Rotation]);
        drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::GREEN,
                           sliderValue[sliderType::Thickness]);
        drawNode->properties.setPosition(Vec2(-100, -300));
        drawNode->properties.setRotation(sliderValue[sliderType::Rotation]);
        drawNode->properties.setCenter(vertices1[0]);
        drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::MAGENTA,
                           sliderValue[sliderType::Thickness]);
        drawNode->properties.setPosition(Vec2(200, 0));
        drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::RED,
                           sliderValue[sliderType::Thickness]);
        drawNode->properties.setPosition(Vec2(0.0f, -300.0f));
        drawNode->properties.setRotation(rotation / 10.0f);
        drawNode->properties.setScale(Vec2(2.0f, 2.0f));
        drawNode->properties.setCenter(vertices1[4]);
        drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::BLUE,
                           sliderValue[sliderType::Thickness]);
        drawNode->properties.setRotation(rotation);
        drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::YELLOW,
                           sliderValue[sliderType::Thickness]);
        drawNode->properties.setRotation(-rotation / 5);
        drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::WHITE,
                           sliderValue[sliderType::Thickness]);

        drawNode->properties.setDefaultValues();
        drawNode->drawPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), true, Color::GREEN,
                           sliderValue[sliderType::Thickness]);
        break;
    }
    case drawMethodes::Polygon:
    {
        drawNode->properties.setPosition(Vec2(0, -300));
        drawNode->properties.setRotation(sliderValue[sliderType::Rotation]);
        drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::GREEN,
                              sliderValue[sliderType::Thickness], Color::YELLOW);
        drawNode->properties.setPosition(Vec2(-100, -300));
        drawNode->properties.setRotation(sliderValue[sliderType::Rotation]);
        drawNode->properties.setCenter(vertices1[0]);
        drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::MAGENTA,
                              sliderValue[sliderType::Thickness], Color::GRAY);
        drawNode->properties.setPosition(Vec2(200, 0));
        drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::RED,
                              sliderValue[sliderType::Thickness], Color::YELLOW);

        drawNode->properties.setPosition(Vec2(0.0f, -300.0f));
        drawNode->properties.setRotation(rotation / 10.0f);
        drawNode->properties.setScale(Vec2(2.0f, 2.0f));
        drawNode->properties.setCenter(vertices1[4]);
        drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::BLUE,
                              sliderValue[sliderType::Thickness], Color::WHITE);
        drawNode->properties.setRotation(rotation);
        drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::YELLOW,
                              sliderValue[sliderType::Thickness], Color::GREEN);
        ;
        drawNode->properties.setRotation(-rotation / 5);
        drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::WHITE,
                              sliderValue[sliderType::Thickness], Color::YELLOW);

        drawNode->properties.setDefaultValues();
        drawNode->drawPolygon(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::GREEN,
                              sliderValue[sliderType::Thickness], Color::BLUE);

        break;
    }
    case drawMethodes::Dot:
    {
        for (int i = 0; i < 100; i++)
        {
            drawNode->drawDot(Vec2(AXRANDOM_MINUS1_1() * 400 + 200, AXRANDOM_MINUS1_1() * 400),
                              20 + sliderValue[sliderType::Thickness], Color::random().withAlpha(1.0f));
        }

        break;
    }
    case drawMethodes::Point:
    {
        for (int i = 0; i < 100; i++)
        {
            drawNode->drawPoint(Vec2(AXRANDOM_MINUS1_1() * 400 + 200, AXRANDOM_MINUS1_1() * 400),
                                30 + sliderValue[sliderType::Thickness], Color::random().withAlpha(1.0f));
        }
        break;
    }
    case drawMethodes::Points:
    {
        for (int i = 0; i < 100; i++)
        {
            Vec2 pos        = Vec2(-100, -100) + Vec2(AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x,
                                                      AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y);
            Vec2 position[] = {{60 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x,
                                60 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y / 2},
                               {70 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x,
                                70 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y / 2},
                               {60 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x,
                                60 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y / 2},
                               {70 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x,
                                70 + AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y / 2}};
            drawNode->drawPoints(position, 4, 10 + 2 * sliderValue[sliderType::Thickness],
                                 Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
        }
        break;
    }
    case drawMethodes::Triangle:
    {
        static Color color3[] = {Color::GREEN, Color::BLUE, Color::RED};
        drawNode->properties.setPosition(center);
        drawNode->properties.setScale(Vec2(10, 10));

        {
            drawNode->drawTriangle(Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
                                   Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
                                   Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Color::RED);
        }
        {
            Vec2 triangle[] = {Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
                               Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
                               Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20};

            drawNode->drawColoredTriangle(triangle, color3);
        }
        break;
    }
    case drawMethodes::SolidTriangle:
    {
        static Vec2 triangle[] = {Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30,
                                  Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30,
                                  Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30};
        drawNode->properties.setPosition(center);
        drawNode->properties.setScale(Vec2(10, 10));
        // for (int i = 0; i < 10; i++)
        {

            drawNode->drawSolidTriangle(Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
                                        Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
                                        Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Color::RED, Color::BLUE,
                                        sliderValue[sliderType::Thickness]);

            drawNode->properties.setPosition(center - Vec2(200, 200));
            drawNode->drawSolidTriangle(triangle, Color::GREEN, Color::BLUE, sliderValue[sliderType::Thickness]);
        }
        break;
    }
    case drawMethodes::Segment:
    {
        labelRound->setVisible(true);
        labelSquare->setVisible(true);
        labelButt->setVisible(true);

        int yy1 = 150;
        int yy  = 0;
        drawNode->drawSegment(Vec2(-150.0f, yy - yy1), Vec2(200, yy - yy1), 20 + 5 * sliderValue[sliderType::Thickness],
                              Color::GREEN, DrawNode::Round, DrawNode::Round);
        labelRound->setPosition(Vec2(250.0f, 85));

        yy += 170;
        drawNode->drawSegment(Vec2(-150.0f, yy - yy1), Vec2(200, yy - yy1), 20 + 5 * sliderValue[sliderType::Thickness],
                              Color::BLUE, DrawNode::Square, DrawNode::Square);
        labelSquare->setPosition(Vec2(250.0f, 170));

        yy += 170;
        drawNode->drawSegment(Vec2(-150.0f, yy - yy1), Vec2(200, yy - yy1), 20 + 5 * sliderValue[sliderType::Thickness],
                              Color::RED, DrawNode::Butt, DrawNode::Butt);
        labelButt->setPosition(Vec2(250.0f, 255));

        break;
    }
    case drawMethodes::SolidCircle:
    {
        static Vec2 pos =
            Vec2(AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x, AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y);

        float thickness = 2.0f;

        drawNode->drawSolidCircle(
            VisibleRect::center(), AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10, 1.0f,
            1.0f, Color::random().withAlpha(1.0f), sliderValue[sliderType::Thickness], Color::random().withAlpha(1.0f));

        drawNode->drawSolidCircle(VisibleRect::center() + pos, AXRANDOM_0_1() * 200,
                                  AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10, 1.0f, 1.0f,
                                  Color::random().withAlpha(1.0f), sliderValue[sliderType::Thickness],
                                  Color::random().withAlpha(1.0f));

        drawNode->drawSolidCircle(VisibleRect::center() - pos, AXRANDOM_0_1() * 200,
                                  AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10, 1.0f, 1.0f,
                                  Color::random().withAlpha(1.0f), sliderValue[sliderType::Thickness],
                                  Color::random().withAlpha(1.0f));

        // for (int i = 5; i > 1; i--)
        //{
        //     drawNode->drawSolidCircle(
        // VisibleRect::center(), 3 * i, AX_DEGREES_TO_RADIANS(90), AXRANDOM_0_1() * 20.f + 20.f, 1.0f, 1.0f,
        // Color::random().withAlpha(1.0f), sliderValue[sliderType::Thickness],
        // Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

        //    drawNode->drawSolidCircle(
        //        VisibleRect::center() + pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90),
        //        10, 1.0f, 1.0f, Color::random().withAlpha(1.0f),
        //        sliderValue[sliderType::Thickness], Color::random().withAlpha(1.0f));
        //}

        break;
    }
    case drawMethodes::SolidPoly:
    {
        Vec2 ppp = Vec2(AXRANDOM_MINUS1_1() * size.x / 2, AXRANDOM_MINUS1_1() * size.y / 2);
        drawNode->properties.setPosition(Vec2(ppp));

        drawNode->properties.setPosition(Vec2(0.0f, -300.0f));
        drawNode->properties.setRotation(rotation / 10.0f);
        drawNode->properties.setScale(Vec2(2.0f, 2.0f));
        drawNode->properties.setCenter(vertices1[4]);
        drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::BLUE);
        drawNode->properties.setRotation(rotation);
        drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::YELLOW);
        drawNode->properties.setRotation(-rotation / 5);
        drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::WHITE);

        drawNode->properties.setDefaultValues();
        drawNode->drawSolidPoly(vertices1, sizeof(vertices1) / sizeof(vertices1[0]), Color::GREEN);

        break;
    }
    case drawMethodes::SolidRect:
    {
        for (int i = 0; i < 100; i++)
        {
            Vec2 pos = Vec2(-100, -100) + Vec2(AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x,
                                               AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y);
            drawNode->drawSolidRect(
                pos, pos + Vec2(20.0f * sliderValue[sliderType::Thickness], 20.0f * sliderValue[sliderType::Thickness]),
                Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f), sliderValue[sliderType::Thickness]);
        }

        break;
    }
    case drawMethodes::Star:
    {

        Vec2 gear1 = {270.f, 320.f};
        Vec2 gear2 = {160.f, 320.f};
        Vec2 gear3 = {200.f, 200.f};
        Vec2 gear4 = {size.width - 200, size.height - 200};

        drawNode->properties.setRotation(rotation + 45);
        drawNode->properties.setCenter(gear1);
        drawNode->drawStar(Vec2(gear1), 30, 60, 8, Color::BLUE, 4.0);
        drawNode->properties.setRotation(-rotation);
        drawNode->properties.setCenter(gear2);
        drawNode->drawStar(gear2, 30, 60, 8, Color::GREEN, 4.0);

        drawNode->properties.setDefaultValues();
        drawNode->drawLine(gear2, gear1, Color::RED, sliderValue[sliderType::Thickness]);  // line
        drawNode->properties.setCenter(gear4);
        drawNode->properties.setRotation(rotation + 45);
        drawNode->drawStar(gear3, 30, 60, 18, Color::RED, 1.0);
        drawNode->drawLine(gear3, gear4, Color::YELLOW, sliderValue[sliderType::Thickness]);  // line
        // drawNode->properties.setDefaultValues();
        drawNode->properties.setRotation(rotation - 45);
        drawNode->properties.setCenter(gear4);
        drawNode->drawStar(gear4, 40, 60, 60, Color::GREEN, 1.0);

        drawNode->properties.setRotation(rotation);
        drawNode->properties.setCenter(Vec2(-110, 250));
        drawNode->drawStar(Vec2(-110, 250), 30, 70, 5, Color::GREEN, 1.0);
        drawNode->properties.setCenter(Vec2(-150, 100));
        drawNode->drawStar(Vec2(-150, 100), 80, 100, 40, Color::GREEN, 1.0);
        drawNode->properties.setCenter(Vec2(-150, -100));
        drawNode->drawStar(Vec2(-150, -100), 5, 70, 3, Color::GREEN, 1.0);

        drawNode->properties.setRotation(0);
        for (int i = 0; i < 10; i++)
        {
            Vec2 ppp = Vec2(AXRANDOM_MINUS1_1() * size.x / 2, AXRANDOM_MINUS1_1() * size.y / 2);
            drawNode->properties.setPosition(Vec2(ppp));
            drawNode->drawStar(
                Vec2::ZERO, 40, 60, AXRANDOM_0_1() * 60 + 3,
                Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), sliderValue[sliderType::Thickness]));
        }
        break;
    }
    case drawMethodes::SolidStar:
    {
        Vec2 gear1 = {270.f, 320.f};
        Vec2 gear2 = {160.f, 320.f};
        Vec2 gear3 = {200.f, 200.f};
        Vec2 gear4 = {size.width - 200, size.height - 200};

        drawNode->properties.setRotation(rotation + 45);
        drawNode->properties.setCenter(gear1);
        drawNode->drawSolidStar(Vec2(gear1), 30, 60, 8, Color::BLUE, Color::YELLOW, 4.0);
        drawNode->properties.setRotation(-rotation);
        drawNode->properties.setCenter(gear2);
        drawNode->drawSolidStar(gear2, 30, 60, 8, Color::GREEN, Color::YELLOW, 4.0);

        drawNode->properties.setDefaultValues();
        drawNode->drawLine(gear2, gear1, Color::RED, sliderValue[sliderType::Thickness]);  // line
        drawNode->properties.setCenter(gear4);
        drawNode->properties.setRotation(rotation + 45);
        drawNode->drawSolidStar(gear3, 30, 60, 18, Color::RED, Color::YELLOW, 1.0);
        drawNode->drawLine(gear3, gear4, Color::YELLOW, sliderValue[sliderType::Thickness]);  // line
        drawNode->properties.setDefaultValues();
        drawNode->properties.setRotation(rotation - 45);
        drawNode->properties.setCenter(gear4);
        drawNode->drawSolidStar(gear4, 40, 60, 60, Color::GREEN, Color::YELLOW, 1.0);

        drawNode->properties.setRotation(rotation);
        drawNode->properties.setCenter(Vec2(-110, 250));
        drawNode->drawSolidStar(Vec2(-110, 250), 30, 70, 5, Color::GREEN, Color::YELLOW, 1.0);
        drawNode->properties.setCenter(Vec2(-150, 100));
        drawNode->drawSolidStar(Vec2(-150, 100), 80, 100, 40, Color::GREEN, Color::YELLOW, 1.0);
        drawNode->properties.setCenter(Vec2(-150, -100));
        drawNode->drawSolidStar(Vec2(-150, -100), 5, 70, 3, Color::GREEN, Color::YELLOW, 1.0);

        drawNode->properties.setRotation(0);
        for (int i = 0; i < 10; i++)
        {
            Vec2 ppp = Vec2(AXRANDOM_MINUS1_1() * size.x / 2, AXRANDOM_MINUS1_1() * size.y / 2);
            drawNode->properties.setPosition(Vec2(ppp));
            drawNode->drawSolidStar(Vec2::ZERO, 40, 60, AXRANDOM_0_1() * 60 + 3, Color::random().withAlpha(1.0f),
                                    Color::random().withAlpha(1.0f));
        }

        break;
    }

    default:
        break;
    }
}

DrawNodeDrawInWrongOrder_Issue1888::DrawNodeDrawInWrongOrder_Issue1888()
{
    drawNode->properties.setDrawOrder(true);
    scheduleUpdate();
}

std::string DrawNodeDrawInWrongOrder_Issue1888::title() const
{
    return "Issue #1888: Drawing order";
}

std::string DrawNodeDrawInWrongOrder_Issue1888::subtitle() const
{
    return "Red behind all. Green behind the blue/grey.\nRandom Points behind the squares. Blue is top.";
}

void DrawNodeDrawInWrongOrder_Issue1888::update(float dt)
{
    DrawNodeBaseTest::update(dt);

    drawNode->clear();

    drawNode->drawLine(Vec2(20, 140), Vec2(450, 110), Color::RED, 20.0f);

    for (int i = 0; i < 200; i++)
    {
        Vec2 position1[] = {
            {60 + AXRANDOM_0_1() * VisibleRect::rightTop().x, 60 + AXRANDOM_0_1() * VisibleRect::rightTop().y},
            {70 + AXRANDOM_0_1() * VisibleRect::rightTop().x, 70 + AXRANDOM_0_1() * VisibleRect::rightTop().y},
            {60 + AXRANDOM_0_1() * VisibleRect::rightTop().x, 60 + AXRANDOM_0_1() * VisibleRect::rightTop().y},
            {70 + AXRANDOM_0_1() * VisibleRect::rightTop().x, 70 + AXRANDOM_0_1() * VisibleRect::rightTop().y}};
        drawNode->drawPoints(position1, 4, 10, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
    }

    drawNode->drawSolidRect(Vec2(150, 80), Vec2(400, 220), Color::YELLOW);

    for (int i = 0; i < 50; i++)
    {
        drawNode->drawPoint(Vec2(i * 7.0f, 120.0f), (float)i / 5 + 1, Color::random().withAlpha(1.0f));
    }

    drawNode->drawLine(Vec2(20, 100), Vec2(450, 220), Color::GREEN, 8.0f);

    drawNode->drawLine(Vec2(200, 100), Vec2(450, 250), Color::BLUE, 6.0f);
}

DrawNodeAxmolTest2::DrawNodeAxmolTest2()
{
    selectedRadioButton = 0;

    _radioButtonGroup = ui::RadioButtonGroup::create();
    addChild(_radioButtonGroup, 50);

    static const float BUTTON_WIDTH = 30;
    static float startPosX          = 0;

    // Create the radio buttons
    static const int NUMBER_OF_BUTTONS = 2;
    startPosX                          = size.width / 2.0f - ((NUMBER_OF_BUTTONS - 1) / 2.0f) * BUTTON_WIDTH;
    for (int i = 0; i < NUMBER_OF_BUTTONS; ++i)
    {
        ui::RadioButton* radioButton =
            ui::RadioButton::create("cocosui/radio_button_off.png", "cocosui/radio_button_on.png");
        float posX = startPosX + BUTTON_WIDTH * i;
        radioButton->setPosition(Vec2(posX, size.height - 80));
        radioButton->setScale(1.2f);
        radioButton->setTag(i);
        _radioButtonGroup->addRadioButton(radioButton);
        addChild(radioButton, 50);
        radioButton->addEventListener(AX_CALLBACK_2(DrawNodeAxmolTest2::onChangedRadioButtonSelect, this));
    }

    drawNode = DrawNode::create();
    drawNode->properties.setTransform(true);
    addChild(drawNode, 10);

    scheduleUpdate();
}

void DrawNodeAxmolTest2::onChangedRadioButtonSelect(ui::RadioButton* radioButton, ui::RadioButton::EventType type)
{
    if (radioButton == nullptr)
    {
        return;
    }
    switch (type)
    {
    case ui::RadioButton::EventType::SELECTED:
    {
        selectedRadioButton = radioButton->getTag();
        break;
    }

    case ui::RadioButton::EventType::UNSELECTED:
    {
        break;
    }
    default:
        break;
    }
}

void DrawNodeAxmolTest2::update(float dt)
{
    DrawNodeBaseTest::update(dt);

    if (!drawNode || !drawNode)
    {
        return;
    }

    drawNode->clear();

    switch (selectedRadioButton)
    {
    case 0:
        setSubtitleLabel("Axmol v2 drawOrder ON (T)");
        drawAllv2(drawNode, true);
        break;
    case 1:
        setSubtitleLabel("Axmol v2 drawOrder OFF (T,P,L)");
        drawAllv2(drawNode, false);
        break;
    default:
        break;
    }
}

void DrawNodeAxmolTest2::drawAllv2(DrawNode* drawNode, bool drawOrder)
{
    drawNode->properties.setDrawOrder(drawOrder);

    drawNode->drawPoint(Vec2(size.width / 2 - 120, size.height / 2 - 120), 10,
                        Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    drawNode->drawPoint(Vec2(size.width / 2 + 120, size.height / 2 + 120), 10,
                        Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    // drawNode 4 small points
    Vec2 position[] = {Vec2(60, 60), Vec2(70, 70), Vec2(60, 70), Vec2(70, 60)};
    drawNode->drawPoints(position, 4, 5, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    // drawNode a line
    drawNode->drawLine(Vec2(0, 0), Vec2(size.width, size.height), Color(1.0, 0.0, 0.0, 0.5));

    // drawNode a rectangle
    drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color::RED);

    drawNode->drawRect(Vec2(15, 30), Vec2(30, 15), Vec2(15, 0), Vec2(0, 15),
                       Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));

    // drawNode a circle
    drawNode->drawCircle(VisibleRect::center() + Vec2(140, 0), 100, AX_DEGREES_TO_RADIANS(90), 30, true, 1.0f, 2.0f,
                         Color(1.0f, 0.0f, 0.0f, 0.5f));

    drawNode->drawCircle(VisibleRect::center() - Vec2(140, 0), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
                         Color::random().withAlpha(1.0f));

    // drawNode some beziers
    drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10),
                             Vec2(size.width - 10, size.height - 10), 10,
                             Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    drawNode->drawQuadBezier(Vec2(0.0f, size.height), Vec2(size.width / 2, size.height / 2),
                             Vec2(size.width, size.height), 50,
                             Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50),
                              Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(),
                              100, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    drawNode->drawCubicBezier(Vec2(size.width - 250, 40.0f), Vec2(size.width - 70, 100.0f),
                              Vec2(size.width - 30, 250.0f), Vec2(size.width - 10, size.height - 50), 10,
                              Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    auto array = PointArray::create(20);
    array->addControlPoint(Vec2(0.0f, 0.0f));
    array->addControlPoint(Vec2(80.0f, 80.0f));
    array->addControlPoint(Vec2(size.width - 80, 80.0f));
    array->addControlPoint(Vec2(size.width - 80, size.height - 80));
    array->addControlPoint(Vec2(80.0f, size.height - 80));
    array->addControlPoint(Vec2(80.0f, 80.0f));
    array->addControlPoint(Vec2(size.width / 2, size.height / 2));
    drawNode->drawCardinalSpline(array, 0.5f, 50, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    auto array2 = PointArray::create(20);
    array2->addControlPoint(Vec2(size.width / 2, 30.0f));
    array2->addControlPoint(Vec2(size.width - 80, 30.0f));
    array2->addControlPoint(Vec2(size.width - 80, size.height - 80));
    array2->addControlPoint(Vec2(size.width / 2, size.height - 80));
    array2->addControlPoint(Vec2(size.width / 2, 30.0f));
    drawNode->drawCatmullRom(array2, 50, Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    // open random color poly
    Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f),
                       Vec2(50.0f, 100.0f)};
    drawNode->drawPoly(vertices, 5, false, Color::random().withAlpha(1.0f));

    // closed random color poly
    Vec2 vertices2[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)};
    drawNode->drawPoly(vertices2, 3, true, Color::random().withAlpha(1.0f));

    // drawNode 10 circles
    for (int i = 0; i < 10; i++)
    {
        drawNode->drawDot(Vec2(size.width / 2, size.height / 2), 10.f * (10 - i), Color::random().withAlpha(1.0f));
    }

    // drawNode polygons
    Vec2 points[] = {Vec2(size.height / 4, 0.0f), Vec2(size.width, size.height / 5),
                     Vec2(size.width / 3 * 2, size.height)};
    drawNode->drawPolygon(points, sizeof(points) / sizeof(points[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 4,
                          Color(0.0f, 0.0f, 1.0f, 0.5f));

    // star poly (triggers buggs)
    {
        const float o = 80;
        const float w = 20;
        const float h = 50;
        Vec2 star[]   = {
            Vec2(o + w, o - h), Vec2(o + w * 2, o),                  // lower spike
            Vec2(o + w * 2 + h, o + w), Vec2(o + w * 2, o + w * 2),  // right spike
                                                                     //{o +w, o+w*2+h}, {o,o+w*2},        // top spike
                                                                     //{o -h, o+w}, {o,o}, // left spike
        };

        drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1,
                              Color(0.0f, 0.0f, 1.0f, 1.0f));
    }

    // star poly (doesn't trigger bug... order is important un tesselation is supported.
    {
        const float o = 180;
        const float w = 20;
        const float h = 50;
        Vec2 star[]   = {
            Vec2(o, o),
            Vec2(o + w, o - h),
            Vec2(o + w * 2, o),  // lower spike
            Vec2(o + w * 2 + h, o + w),
            Vec2(o + w * 2, o + w * 2),  // right spike
            Vec2(o + w, o + w * 2 + h),
            Vec2(o, o + w * 2),  // top spike
            Vec2(o - h, o + w),  // left spike
            Vec2(o, o),          // left spike
        };

        drawNode->drawPolygon(star, sizeof(star) / sizeof(star[0]), Color(1.0f, 0.0f, 0.0f, 0.5f), 1,
                              Color(0.0f, 0.0f, 1.0f, 1.0f));
    }

    // drawNode a solid polygon
    Vec2 vertices3[] = {Vec2(60.0f, 160.0f), Vec2(70.0f, 190.0f), Vec2(100.0f, 190.0f), Vec2(90.0f, 160.0f)};
    drawNode->drawSolidPoly(vertices3, 4, Color(1.0f, 1.0f, 0.0f, 1.0f));

    // drawNode a solid rectangle
    drawNode->drawSolidRect(Vec2(10.0f, 10.0f), Vec2(20.0f, 20.0f), Color(1.0f, 1.0f, 0.0f, 1.0f));

    // drawNode a solid circle
    drawNode->drawSolidCircle(VisibleRect::center() + Vec2(140.0f, 0.0f), 40, AX_DEGREES_TO_RADIANS(90), 50, 2.0f, 2.0f,
                              Color(0.0f, 1.0f, 0.0f, 1.0f));

    // drawNode segment
    drawNode->drawSegment(Vec2(20.0f, size.height), Vec2(20.0f, size.height / 2), 10, Color(0.0f, 1.0f, 0.0f, 1.0f));

    drawNode->drawSegment(Vec2(10.0f, size.height / 2), Vec2(size.width / 2, size.height / 2), 40,
                          Color(1.0f, 0.0f, 1.0f, 0.5f));

    // drawNode triangle
    drawNode->drawTriangle(Vec2(10.0f, 10.0f), Vec2(70.0f, 30.0f), Vec2(100.0f, 140.0f),
                           Color(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));

    for (int i = 0; i < 100; i++)
    {
        drawNode->drawPoint(Vec2(i * 7.0f, 5.0f), (float)i / 5 + 1, Color::random().withAlpha(1.0f));
    }

    drawNode->drawLine(Vec2(0.0f, size.height), Vec2(size.width, size.height - 20), Color::YELLOW);
    drawNode->drawLine(Vec2(0.0f, 0.0f), Vec2(size.width, size.height - 20), Color::YELLOW);
}

string DrawNodeAxmolTest2::title() const
{
    return "DrawNode Order test";
}

string DrawNodeAxmolTest2::subtitle() const
{
    return "";
}

DrawNodeIssueTester::DrawNodeIssueTester()
{
    static Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f),
                              Vec2(50.0f, 100.0f)};
    int verticesCount      = 5;

    drawNode->properties.setPosition(Vec2(5, 150));
    drawNode->drawPoly(vertices, verticesCount, false, Color::GREEN);

    auto draw = DrawNode::create();
    addChild(draw, 10);
    draw->setPosition(70, 150);
    draw->drawPoly(vertices, verticesCount, false, Color::BLUE);

    drawNode->properties.setPosition(Vec2(140, 150));

    drawNode->drawPoly(vertices, verticesCount, false, Color::RED);

    drawNode->properties.setPosition(Vec2(200, 150));

    drawNode->drawPoly(vertices, verticesCount, false, Color::RED, 3);
    drawNode->drawPoly(vertices, verticesCount, false, Color::WHITE);

    drawNode->properties.setPosition(Vec2(270, 150));

    drawNode->drawPoly(vertices, verticesCount, false, Color(0.0f, 0.5f, 0.5f, 0.5f), 10);
    drawNode->drawPoly(vertices, verticesCount, false, Color::BLACK);

    float thick = 0.0f;
    float y     = -90.0f;
    drawNode->properties.setPosition(Vec2(270, 100));
    for (int i = 0; i < 32; i++)
    {
        thick += 0.5f;
        y += thick + 1;
        drawNode->drawLine(Vec2(140, y), Vec2(180, y), Color::random().withAlpha(1.0f), thick);
    }
    drawNode->drawPie(Vec2(-220, 150), 20, 0, 100, 300, 1, 1, Color::TRANSPARENT, Color::BLUE, DrawNode::DrawMode::Line,
                      10);

    drawNode->properties.setPosition(Vec2(50, -100));
    for (int i = 2; i < 30; i++)
    {
        drawNode->drawCircle(center, 5 * i, AX_DEGREES_TO_RADIANS(90), i, false, 1.0f, 1.0f,
                             Color::random().withAlpha(1.0f), 0.5f);
    }

    Vec2* fbHorse = new Vec2[856 / 2];
    int n         = 0;
    Vec2 pos      = {100, 210};
    float scale   = 3.0f;
    drawNode->properties.setPosition(Vec2(-90, -160));
    for (size_t i = 0; i < sizeof(verticesFB) / sizeof(verticesFB[0]); i += 4)
    {
        drawNode->drawLine(Vec2(verticesFB[i] * scale, verticesFB[i + 1] * scale) + pos,
                           Vec2(verticesFB[i + 2] * scale, verticesFB[i + 3] * scale) + pos, Color::RED, 0.5f);
    }

    drawNode->properties.setPosition(VisibleRect::center() - Vec2(100, 50));
    drawNode->drawSolidCircle(Vec2::ZERO, 40, AX_DEGREES_TO_RADIANS(-90), 30, 1.0f, 1.0f, Color::GREEN, 6, Color::BLUE,
                              false);
    drawNode->drawSolidCircle(Vec2(100, 0), 40, AX_DEGREES_TO_RADIANS(-90), 30, 1.0f, 1.0f, Color::RED, 6, Color::BLUE,
                              true);

    drawNode->drawCircle(Vec2(100, 100), 40, AX_DEGREES_TO_RADIANS(-90), 30, true, 1.0f, 1.0f, Color::GREEN, 6);

    drawNode->drawCircle(Vec2(0, 100), 40, AX_DEGREES_TO_RADIANS(-90), 30, false, 1.0f, 1.0f, Color::RED, 6);

    // scheduleUpdate();
}

void DrawNodeIssueTester::onEnter()
{
    DrawNodeBaseTest::onEnter();
}

void DrawNodeIssueTester::update(float dt)
{
    DrawNodeBaseTest::update(dt);
}

string DrawNodeIssueTester::title() const
{
    return "";
}

string DrawNodeIssueTester::subtitle() const
{
    return "";
}

DrawNodeCircleTest::DrawNodeCircleTest()
{
    drawNode->properties.setPosition(Vec2(100, 0));
    for (int i = 3; i <= 8; i++)
    {
        drawNode->drawCircle(center, 10 * i, AX_DEGREES_TO_RADIANS(90), i, false, 1.0f, 1.0f, Color::WHITE);
    }
    drawNode->drawCircle(center, 90, AX_DEGREES_TO_RADIANS(90), 36, false, 1.0f, 1.0f, Color::WHITE);

    for (size_t i = 0; i < 3; i++)
    {
        drawNode->properties.setPosition(Vec2(0, 0));
        drawNode->drawCircle(Vec2(120, 150), 80 - 19 * i, AX_DEGREES_TO_RADIANS(90), 5, false, 1.0f, 1.0f, Color::BLUE,
                             3.0f);
    }

    drawNode->properties.setCenter(Vec2(120, 150));
    for (int i = 0; i < 5; i++)
    {
        drawNode->properties.setRotation(AX_DEGREES_TO_RADIANS(360 / 5 * i));
        drawNode->drawSolidCircle(Vec2(120, 195), 10, 0, 36, 1.0f, 1.0f, Color::BLUE);
        drawNode->drawSolidCircle(Vec2(120, 210), 12, 0, 36, 1.0f, 1.0f, Color::BLUE);
        drawNode->drawSolidCircle(Vec2(120, 230), 16, 0, 36, 1.0f, 1.0f, Color::BLUE);
    }
}

std::string DrawNodeCircleTest::title() const
{
    return "Circle Test";
}

std::string DrawNodeCircleTest::subtitle() const
{
    return "Axmol, N-Corner, Circle";
}

DrawNodeSpLinesTest::DrawNodeSpLinesTest()
{
    drawNode = DrawNode::create();
    drawNode->properties.setTransform(true);
    addChild(drawNode, 30);

    screen = Director::getInstance()->getVisibleSize();
    origin = Director::getInstance()->getVisibleOrigin();
    center = Vec2(screen.width / 2, screen.height / 2);
    sixth  = Vec2(screen.width / 6, screen.height / 6);

    defY  = (int)(center.y + sixth.y);
    defY2 = (int)(center.y - sixth.y);
    dev   = sixth.y;

    pts  = PointArray::create(n);
    pts2 = PointArray::create(n);
    pts->retain();
    pts2->retain();
    for (int i = 0; i < n; ++i)
    {
        pts->insertControlPoint(Vec2(0, 0), i);
        pts2->insertControlPoint(Vec2(0, 0), i);
    }

    DrawNodeBaseTest::generateDataPoints();
    scheduleUpdate();
}

std::string DrawNodeSpLinesTest::title() const
{
    return "Testing SpLines";
}

std::string DrawNodeSpLinesTest::subtitle() const
{
    return "";
}

void DrawNodeSpLinesTest::update(float dt)
{
    drawNode->clear();

    // Issue #2302
    auto array = PointArray::create(20);
    for (int i = 0; i < 10; i++)
    {
        array->addControlPoint(Vec2((i % 2) ? 20 : screen.width - 20, 50 + i * 20));
        drawNode->drawPoint(array->getControlPointAtIndex(i), 10, Color::BLUE, DrawNode::PointType::Circle);
    }
    drawNode->drawCardinalSpline(array, 0.1, 20, Color::ORANGE);

    drawNode->drawCardinalSpline(pts, 0.5f, 360, Color::RED, 5.0f);
    drawNode->drawCardinalSpline(pts2, 0.5f, 360, Color::GREEN, 2.0f);

    int i1 = RandomHelper::random_int(0, n - 1);
    int i2 = RandomHelper::random_int(0, n - 1);
    drawNode->drawDot(pts->getControlPointAtIndex(i1), 7, Color(0, 1, 0, 0.3));
    drawNode->drawDot(pts->getControlPointAtIndex(i1), 4, Color::GREEN);

    drawNode->drawDot(pts2->getControlPointAtIndex(i2), 7, Color(0, 1, 0, 0.3));
    drawNode->drawDot(pts2->getControlPointAtIndex(i2), 4, Color::GREEN);
}

DrawNodeSpLinesOpenClosedTest::DrawNodeSpLinesOpenClosedTest()
{
    auto listener            = EventListenerTouchAllAtOnce::create();
    listener->onTouchesEnded = AX_CALLBACK_2(DrawNodeSpLinesOpenClosedTest::onTouchesEnded, this);
    _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);

    drawNodeCP = DrawNode::create();
    drawNodeCP->properties.setTransform(true);
    addChild(drawNodeCP, 50);

    drawNode = DrawNode::create();
    drawNode->properties.setTransform(true);
    addChild(drawNode, 30);

    screen = Director::getInstance()->getVisibleSize();
    origin = Director::getInstance()->getVisibleOrigin();
    center = Vec2(screen.width / 2, screen.height / 2);
    sixth  = Vec2(screen.width / 6, screen.height / 6);

    defY  = (int)(center.y + sixth.y);
    defY2 = (int)(center.y - sixth.y);
    dev   = sixth.y;

    pts  = PointArray::create(n);
    pts2 = PointArray::create(n);
    pts->retain();
    pts2->retain();
    for (int i = 0; i < n; ++i)
    {
        pts->insertControlPoint(Vec2(0, 0), i);
        pts2->insertControlPoint(Vec2(0, 0), i);
    }

    auto closeLabel = Label::createWithTTF("Closed Spline GREEN", "fonts/Marker Felt.ttf", 14);
    closeLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
    closeLabel->setPosition(Vec2(10, 200));
    closeLabel->setTextColor(Color32::GREEN);
    this->addChild(closeLabel, 1);
    auto openLabel = Label::createWithTTF("Open Spline RED", "fonts/Marker Felt.ttf", 14);
    openLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
    openLabel->setPosition(Vec2(10, 220));
    openLabel->setTextColor(Color32::RED);
    this->addChild(openLabel, 1);
    auto cpLabel = Label::createWithTTF("Control Point YELLOW", "fonts/Marker Felt.ttf", 14);
    cpLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
    cpLabel->setPosition(Vec2(10, 240));
    cpLabel->setTextColor(Color32::YELLOW);
    this->addChild(cpLabel, 1);

    DrawNodeBaseTest::generateDataPoints();
    scheduleUpdate();
}

void DrawNodeSpLinesOpenClosedTest::addNewControlPoint(Vec2 p)
{
    points.emplace_back(Vec2(p.x, p.y));
}

void DrawNodeSpLinesOpenClosedTest::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
{
    for (auto& touch : touches)
    {
        auto location = touch->getLocation();
        addNewControlPoint(location);
    }
}

std::string DrawNodeSpLinesOpenClosedTest::title() const
{
    return "Testing open/closed SpLines";
}

std::string DrawNodeSpLinesOpenClosedTest::subtitle() const
{
    return "Tap screen to add (more) control points";
}

void DrawNodeSpLinesOpenClosedTest::update(float dt)
{
    if (points.size() == 0)
        return;
    if (points.size() > 2)
        array = PointArray::create(points.size() + 4);
    else
        array = PointArray::create(points.size());

    drawNodeCP->clear();
    drawNode->clear();

    int boxSize = 3;
    for (auto&& p : points)
    {
        drawNodeCP->drawSolidRect(Vec2(p.x - boxSize, p.y - boxSize), Vec2(p.x + boxSize, p.y + boxSize),
                                  Color::YELLOW);
        array->addControlPoint(Vec2(p.x, p.y));
    }

    drawNode->drawCardinalSpline(array, 0.0f, static_cast<int>(points.size() * 20), Color::GREEN, 4.0f, true);
    drawNode->drawCardinalSpline(array, 0.0f, static_cast<int>(points.size() * 20), Color::RED, 4.0f, false);
}

#if defined(AX_PLATFORM_PC)
CandyMixEeffect::CandyMixEeffect()
{
    static const float BUTTON_WIDTH = 30;
    static float startPosX          = 0;

    scheduleUpdate();
}

std::string CandyMixEeffect::title() const
{
    return "Performance: Candy Mix";
}

std::string CandyMixEeffect::subtitle() const
{
    return "";
}

void CandyMixEeffect::renderLine(float x1, float x2, float y, ax::Color color, float angle)
{
    static float WID = 400;

    float xMid = (x1 + x2) * 0.5f;
    float r    = color.r;
    float g    = color.g;
    float b    = color.b;
    float rng  = 1.0f / (x2 - xMid);
    x1         = MIN(MAX(0.0f, x1), WID - 1);
    x2         = MIN(MAX(0.0f, x2), WID - 1);

    float mm = 0.8f;

    for (size_t x = x1; x < x2; x++)
    {
        float pos = (x - xMid) * rng;
        float ang = (angle + asin(pos) + (cos((angle + pos * (float)M_PI) * 1.78f) * 0.3f)) + (float)M_PI * 0.5f;
        float sf  = 0.2f + 0.8f * MAX(mm - 0.8, MIN(mm, cos(ang)));
        float sp  = pow(MAX(0, cos(2 * ang)), 20);
        float rr  = MIN(mm, r * sf + sp);
        float gg  = MIN(mm, g * sf + sp);
        float bb  = MIN(mm, b * sf + sp);
        drawNode->drawPoint(Vec2(y, x - 50), 2.0f, Color(rr, gg, bb, 1.0f));
    }
}

void CandyMixEeffect::update(float dt)
{
    DrawNodeBaseTest::update(dt);
    drawNode->clear();

    static auto ticks = b2GetTicks();

    static float WID = 400;
    static float HIG = 600;
    float t          = b2GetMilliseconds(ticks) / 1000.0f;
    float ta         = sin(t * cos(t) * 0.02f) + t;
    float tb         = (1.0f + sin(t) * 1.0f) * 0.02f + 0.01f;
    float xa         = WID * 0.5f;
    for (int y = 0; y < HIG; y++)
    {
        float ya  = y * 0.01f;
        float rad = 60 + sin(ta + ya) * 30;
        float rot = t + sin(ya * 2) * 0.5f + cos(ta * 0.3f) * 0.3f;
        float x1  = xa + sin(rot) * rad;
        float x2  = xa + sin(rot + (float)M_PI * 0.5f) * rad;
        float x3  = xa + sin(rot + (float)M_PI) * rad;
        float x4  = xa + sin(rot + (float)M_PI * 1.5f) * rad;
        if (x1 < x2)
            renderLine(x1, x2, y, Color::RED, rot);
        if (x2 < x3)
            renderLine(x2, x3, y, Color::GREEN, rot + (float)M_PI * 0.5f);
        if (x3 < x4)
            renderLine(x3, x4, y, Color::BLUE, rot + (float)M_PI);
        if (x4 < x1)
            renderLine(x4, x1, y, Color::YELLOW, rot + (float)M_PI * 1.5f);
        t += sin(ta + ya) * tb;
        xa += sin(t + ta) * 0.1f;
    }
}
#endif

#if defined(_WIN32)
#    pragma pop_macro("TRANSPARENT")
#endif
